-
Notifications
You must be signed in to change notification settings - Fork 127
Re-wrap errors #1332
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
Re-wrap errors #1332
Conversation
|
/test |
💚 Build Succeeded
History
cc @jsoriano |
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.
Nice to have all these occurrences replaced, thanks!
| if len(node.Content) == 0 || node.Content[0].Kind != yaml.MappingNode { | ||
| return nil, errors.Wrap(err, "unexpected manifest content") | ||
| return nil, fmt.Errorf("unexpected manifest content: %w", err) | ||
| } |
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 is not right; err is nill here but this returns a non-nil error referring to err.
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.
Thanks, good catch.
Use standard library for errors wrapping.
Most code changes done with
github.com/xdg-go/go-rewrap-errorsandgoimports.Steps followed to prepare this PR:
find . -name "*.go" -exec go run github.com/xdg-go/go-rewrap-errors@latest -w {} \;find . -name "*.go" -exec goimports -w {} \;go mod tidylog.Fatal(fmt.Errorfwithlog.Fatalf(...(not really related, but took the opportunity to fix this).make check-static, and fix linting issues related to error messages.errors.Wrapwould have returned nil (6993819).