We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
go version
1.21.0
Yes
go env
N/A
Follow the documentation of slog.SourceKey and use it with a string value.
The constant slog.SourceKey is documented to have string values.
slog.SourceKey
However, the wrapping example demonstrates that is has a *slog.Source value.
A different package used the example code to remove the directory from log lines. https://github.com/proullon/ramsql/blob/master/engine/log/log.go#L22, which my code indirectly depended on, triggering a type assertion error the error on log.
This problem exists in the [exp/slog package as well](https://pkg.go.dev/golang.org/x/exp/slog#SourceKey
Document the type for SourceKey values as *slog.Source, which is the correct expected value.
Alternatively, the example needs to change.
SourceKey values are documented as strings. https://pkg.go.dev/log/slog#SourceKey)
The text was updated successfully, but these errors were encountered:
CC @jba
Sorry, something went wrong.
Change https://go.dev/cl/523215 mentions this issue: slog: fix documented type for SourceKey
slog: fix documented type for SourceKey
Change https://go.dev/cl/523195 mentions this issue: log/slog: fix documented value type for SourceKey
log/slog: fix documented value type for SourceKey
92f7209
No branches or pull requests
What version of Go are you using (
go version
)?1.21.0
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?N/A
What did you do?
Follow the documentation of slog.SourceKey and use it with a string value.
The constant
slog.SourceKey
is documented to have string values.However, the wrapping example demonstrates that is has a *slog.Source value.
A different package used the example code to remove the directory from log lines. https://github.com/proullon/ramsql/blob/master/engine/log/log.go#L22, which my code indirectly depended on, triggering a type assertion error the error on log.
This problem exists in the [exp/slog package as well](https://pkg.go.dev/golang.org/x/exp/slog#SourceKey
What did you expect to see?
Document the type for SourceKey values as *slog.Source, which is the correct expected value.
Alternatively, the example needs to change.
What did you see instead?
SourceKey values are documented as strings. https://pkg.go.dev/log/slog#SourceKey)
The text was updated successfully, but these errors were encountered: