-
Notifications
You must be signed in to change notification settings - Fork 221
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 non-constant format string errors with Go 1.24 #1745
base: main
Are you sure you want to change the base?
Conversation
Use `errors.New` instead of `fmt.Errorf` and `fmt.Fprint` instead of `fmt.Fprintf` if a non-constant string is used Signed-off-by: Michel Lind <[email protected]>
return nil, errors.New( | ||
"at CST BuildMultipleArityFunctionCallsiteNode: function name not found: " + | ||
builtinFunctionInfo.name, | ||
) |
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.
You could make this (and others) actually format instead of a concatenation:
return nil, errors.New( | |
"at CST BuildMultipleArityFunctionCallsiteNode: function name not found: " + | |
builtinFunctionInfo.name, | |
) | |
return nil, fmt.Errorf( | |
"at CST BuildMultipleArityFunctionCallsiteNode: function name not found: %s", | |
builtinFunctionInfo.name, | |
) |
@@ -163,7 +164,7 @@ func (root *RootNode) IngestAST( | |||
err = nil | |||
|
|||
if ast.RootNode == nil { | |||
return hadWarnings, fmt.Errorf("cannot build CST from nil AST root") | |||
return hadWarnings, errors.New("cannot build CST from nil AST root") |
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.
This one's actually fine.
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.
Thank you!! :)
Use
errors.New
instead offmt.Errorf
andfmt.Fprint
instead offmt.Fprintf
if a non-constant string is usedgolang/go#60529