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
Consider dropping dependency on github.com/pkg/errors #3618
Comments
Unfortunately, Go's native error-wrapping is not a full replacement for pkg/errors, as it doesn't preserve a stack, which limits its usefulness. We are considering to propose maintainers for the https://github.com/pkg/errors package (pkg/errors#245 TBD); overall the package is "feature complete", so likely not much maintenance will be needed. /cc @tonistiigi Was there a specific reason you want the package to be removed? |
Nothing specific exactly, but two broad categories of reasons:
In any case, it's not an urgent need, and your answer is perfectly satisfactory. Especially so if you take on maintainership for it, since that would go toward solving (1) above. If you ever become interested in this, my offer to send a PR stands. 😄 |
Shameless plug: you can switch it to drop-in replacement BTW, go vet does complain on your example |
https://github.com/pkg/errors is deprecated, archived, and in maintenance mode, since Go errors natively support wrapping since Go 1.13.
There are about 200 files in this repo that depend on this package (excluding
vendor/
):It should be a fairly mechanical change:
errors.Wrap(err, "oh no")
becomesfmt.Errorf("oh no: %w", err)
errors.New("oh no")
becomeserrors.New("oh no")
, using the stdliberrors
package.errors.Errorf("oh %q", "no")
becomesfmt.Errorf("oh %q", "no")
It may even be somewhat possible to automate, using
x/tools/go/analysis
(see sigstore/cosign#1887 (comment)).Let me know if you'd be interested in considering a PR to make this change.
The text was updated successfully, but these errors were encountered: