-
Notifications
You must be signed in to change notification settings - Fork 1.5k
chore: remove dependency on "hashicorp/go-multierror" #1322
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
chore: remove dependency on "hashicorp/go-multierror" #1322
Conversation
It seems the project has been unmainted for quite some time already, see for example hashicorp/go-multierror#97 and hashicorp/go-multierror#98. This also removes an uneccessary dependency which slims down the go.mod. Go as of version 1.20 supports appending errors by specifying multiple "%w" formatters in the "fmt.Errorf"[^0] function. [^0]: https://pkg.go.dev/fmt#Errorf
As an update to the previous commit 59f084e, use "errors.Join"[^0] instead of multiple "%w" formatters for "fmt.Errorf". [^0]: https://pkg.go.dev/errors#Join
afb45ba to
1996ec8
Compare
dhui
left a comment
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.
@leonklingele Thanks so much for this PR! I'm all for fewer dependencies.
I like how the nil checks are built into errors.Join(), which simplifies the calling code.
Overall, this LGTM besides the breaking change.
| // MultiError holds multiple errors. | ||
| // | ||
| // Deprecated: Use github.com/hashicorp/go-multierror instead | ||
| type MultiError struct { |
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.
Can you backout this removal as it's a breaking change?
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.
Done with 8cc9cb0, ptal :)
dhui
left a comment
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.
@leonklingele Thanks for adding MultiError back. Could you also update the struct comment?
util.go
Outdated
| "strings" | ||
| ) | ||
|
|
||
| // TODO: This file is not in use anymore inside this project. |
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 comment isn't accurate as FilterCustomQuery is still used. You can update the comment below to mention removing the struct in v5. Also, we should recommend using errors.Join instead of go-multierror.
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're absolutely right 🙈 Updated!
8cc9cb0 to
51306a7
Compare
dhui
left a comment
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.
@leonklingele Thanks for addressing my feedback!
It seems the "hashicorp/go-multierror" project has been unmaintained for quite some time already, see for example hashicorp/go-multierror#97 and hashicorp/go-multierror#98.
This also removes an uneccessary dependency which slims down the go.mod file.
Go as of version 1.20 supports appending errors with "errors.Join"1.
Footnotes
https://pkg.go.dev/errors#Join ↩