-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
refactor: replace urso/sderr with stdlib errors #39839
Conversation
Go 1.20 added multiple errors wrapping so we can migrate to stdlib errors and drop the additional dependency on github.com/urso/sderr
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
|
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
@@ -144,7 +144,7 @@ require ( | |||
github.com/stretchr/testify v1.9.0 | |||
github.com/tsg/go-daemon v0.0.0-20200207173439-e704b93fd89b | |||
github.com/ugorji/go/codec v1.1.8 | |||
github.com/urso/sderr v0.0.0-20210525210834-52b04e8f5c71 | |||
github.com/urso/sderr v0.0.0-20210525210834-52b04e8f5c71 // indirect |
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.
Does go mod why
explain why this is still here?
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.
Yes, see the PR descrition:
can be dropped completely from the dep graph once elastic/go-concert#69 is merged
// FIXME: Use fmt.Errorf("multiple errors during statestore close: %w", errors.Join(err, rollbackErr)) | ||
// when go1.20 is supported. | ||
err = sderr.WrapAll([]error{err, rollbackErr}, "multiple errors during statestore close") | ||
err = fmt.Errorf("multiple errors during statestore close: %w", errors.Join(err, rollbackErr)) |
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.
Do we need the to include rollbackErr
in theerrors.Join
here? We know rollbackErr == nil
so won't it just get discarded?
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.
It will and I'm honestly confused as well since that's what the previous code was doing 😅
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.
It can just be done non-conditionally. I don't know what I was thinking.
err = fmt.Errorf("multiple errors during statestore close: %w", errors.Join(err, s.tx.Rollback()))
Proposed commit message
Go 1.20 added multiple errors wrapping so we can migrate to stdlib errors and drop the additional dependency on github.com/urso/sderr
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Disruptive User Impact
Author's Checklist
How to test this PR locally
Related issues
Use cases
Screenshots
Logs