Drop dependency on github.com/pkg/errors#543
Conversation
Generate changelog in
|
|
Thanks for the PR. I discussed this with my team internally and I think it makes sense to remove the dependency on Out of curiosity, was there any specific issue with |
✅ Successfully generated changelog entry!Need to regenerate?Simply interact with the changelog bot comment again to regenerate these entries. 📋Changelog Preview💡 Improvements
|
There's a Go proverb worth quoting here: "A little copying is better than a little dependency." If a dependency can be replaced with a few lines of code or with the standard library, it probably should be. Every dependency we remove is one less thing that can be compromised, the vendor tree gets smaller, and reviewing future dependency changes becomes easier. The benefits compound over time. |
Before this PR
The project depended on
github.com/pkg/errorsfor wrapping and formatting errors. This adds an extra external dependency for functionality that modern Go provides in the standard library. Keeping it also increases maintenance surface and dependency churn.After this PR
All usages of
github.com/pkg/errorswere replaced with standard-library error handling (fmt.Errorf("...: %w", err)anderrorswhere needed), and the module dependency was removed from go.mod.==COMMIT_MSG==
Drop dependency on github.com/pkg/errors
==COMMIT_MSG==
Possible downsides?
pkg/errorsstack-trace formatting (for example,%+vbehavior), that detail is no longer available from newly wrapped errors.