Repository navigation
version: fix Slog godoc example to compile - #935
Merged
Merged
Conversation
The example for Slog() passed promslog.Config{} by value, but
promslog.New takes *Config, so the snippet does not compile. Use
&promslog.Config{} to match the function signature and the existing
call sites (e.g. promslog/slog.go, promslog/slog_test.go).
Add a compiled ExampleSlog so the documented usage stays in sync with
the API.
Signed-off-by: Sueun Cho <sueun.dev@gmail.com>
SuperQ
reviewed
Jun 30, 2026
| @@ -0,0 +1,26 @@ | |||
| // Copyright 2024 The Prometheus Authors | |||
Member
There was a problem hiding this comment.
Suggested change
| // Copyright 2024 The Prometheus Authors | |
| // Copyright The Prometheus Authors |
SuperQ
approved these changes
Jun 30, 2026
SuperQ
left a comment
Member
There was a problem hiding this comment.
Thanks! Minor nit on the new file copyright.
SuperQ
requested changes
Jul 22, 2026
SuperQ
left a comment
Member
There was a problem hiding this comment.
Actually, I don't see the point of adding the test file. How does it actively enforce the documentation match?
The example only compiles its own copy of the snippet, not the godoc comment, so it does not keep the two in sync. Signed-off-by: Sueun Cho <sueun.dev@gmail.com>
Contributor
Author
|
Sorry for the very slow reply. The notification email for this review got buried and I missed it. You're right, it doesn't. |
SuperQ
approved these changes
Nov 10, 2026
Merged
SuperQ
added a commit
that referenced
this pull request
Nov 12, 2026
What's Changed * expfmt: add ABNF parser for OpenMetrics 2.0 by @bwplotka in #1016 * build(deps): bump ossf/scorecard-action from 2.4.4 to 2.5.0 by @dependabot[bot] in #1032 * build(deps): bump actions/upload-artifact from 7.0.1 to 7.0.2 by @dependabot[bot] in #1033 * build(deps): bump golang.org/x/net from 0.61.0 to 0.62.0 in the golang-org-x group across 1 directory by @dependabot[bot] in #1030 * expfmt: bump go-abnf to v0.5.5 by @PerryLink in #1029 * config: move Secret into its own package by @mrueg in #1024 * build(deps): bump the codeql group with 4 updates by @dependabot[bot] in #1031 * version: fix Slog godoc example to compile by @sueun-dev in #935 * build(deps): bump go.yaml.in/yaml/v2 from 2.4.4 to 2.4.5 by @dependabot[bot] in #1043 * build(deps): bump golang.org/x/oauth2 from 0.37.0 to 0.38.0 in the golang-org-x group across 1 directory by @dependabot[bot] in #1042 * expfmt: support Prometheus text format 1.0.0 by @ArthurSens in #1035 New Contributors * @PerryLink made their first contribution in #1029 * @sueun-dev made their first contribution in #935 **Full Changelog**: v0.73.1...v0.74.0 Signed-off-by: SuperQ <superq@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
Examplein the godoc forversion.Slog()passespromslog.Config{}by value:but
promslog.Newtakes a pointer:so the documented snippet does not compile. Building it verbatim fails with:
This changes it to
&promslog.Config{}, matching the existing call inpromslog/slog_test.go.gofmt,go vet ./version/...andgo test ./version/...pass.