-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
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
Fix violations of non-constant format strings linter #51812
Conversation
6830eec
to
2ada614
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks, I confess I hesitated fixing this one when I saw how many occurrences there were.
I would swap all trace.Foo("%s", err.Error())
calls for just trace.Foo("%s", err)
. In practice it makes little difference, but I think the latter is the better idiom (and this will be heavily copied).
Various helpers have awful signatures like ConvertFoo(err error, args ...any) error
, which begs the question of what one is supposed to do with args
. I suggest cutting args
and pushing whatever extra-information to the caller instead - they can "%w" or trace.Wrap or something else.
2ada614
to
e6c6df2
Compare
Not a big fan if all the |
Agreed. We need to make some time to reimagine trace to better interoperate with Go's changes to error wrapping. |
But this PR doesn't change anything. Prior we would just |
https://pkg.go.dev/github.com/codingllama/semerr#pkg-overview (there's only so much I can resist.) |
Depends on gravitational/teleport.e#6006. Now that we are compliant, the ignore rule was removed from the golangci-lint config to prevent future regressions.
8809325
to
f0b8967
Compare
…1812) Depends on https://github.com/gravitational/teleport.e/pull/6006. Now that we are compliant, the ignore rule was removed from the golangci-lint config to prevent future regressions.
Depends on https://github.com/gravitational/teleport.e/pull/6006. Now that we are compliant, the ignore rule was removed from the golangci-lint config to prevent future regressions.