Skip to content

Conversation

@michel-slm
Copy link
Contributor

@michel-slm michel-slm commented Jan 26, 2025

Use errors.New instead of fmt.Errorf and fmt.Fprint instead of fmt.Fprintf if a non-constant string is used

golang/go#60529

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]>
Comment on lines +82 to 85
return nil, errors.New(
"at CST BuildMultipleArityFunctionCallsiteNode: function name not found: " +
builtinFunctionInfo.name,
)
Copy link

@QuLogic QuLogic Jan 27, 2025

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:

Suggested change
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,
)


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")
Copy link

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.

Copy link
Owner

@johnkerl johnkerl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!! :)

@johnkerl johnkerl merged commit bd2497a into johnkerl:main Feb 5, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants