-
Notifications
You must be signed in to change notification settings - Fork 248
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
Update logging calls for upcoming Go 1.24 #2000
Conversation
The Vet in Go 1.24 will add a new check to the printf analyzer that "reports a diagnostic for calls of the form `fmt.Printf(s)`, where `s` is a non-constant format string, with no other arguments. Such calls are nearly always a mistake as the value of `s` may contain the `%` symbol; use `fmt.Print` instead."
The Vet in Go 1.24 will add a new check to the printf analyzer that "reports a diagnostic for calls of the form `fmt.Printf(s)`, where `s` is a non-constant format string, with no other arguments. Such calls are nearly always a mistake as the value of `s` may contain the `%` symbol; use `fmt.Print` instead."
After these changes, ignition/internal/exec/stages/files/filesystemEntries.go Lines 285 to 295 in e6323fb
|
@ferdnyc Thank you for your contributions! and being on top of that, would you mind just squashing both commits into 1 and including the change for internal? I think we could just do something like this wdyt? return fmt.Errorf("%s", fmt.Sprintf("Ignition encountered an internal error processing %q and must die now. Please file a bug", f.Path)) |
Hum, I don't think that nolint comment is for the format string here. It appears to be for something else. |
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.
LGTM
Ah, okay, well then we can just keep it as is. |
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.
LGTM, and thank you!
Some calls to
Logger.PushPrefix
andLogger.Info
were being passed a single, variable argument, rather than a format string as the first argument (as printf-style functions expect).The Vet in Go's upcoming 1.24 release has a new check that will flag these calls (which were already annotated with
// nolint:govet
comments). Rather than disabling linting, add a format-string first argument to make the calls kosher.