cleanup: don't use pkg/errors#4691
Closed
imjasonh wants to merge 3 commits into
Closed
Conversation
Signed-off-by: Jason Hall <jason@chainguard.dev>
Signed-off-by: Jason Hall <jason@chainguard.dev>
Signed-off-by: Jason Hall <jason@chainguard.dev>
2 tasks
Member
|
Thanks for contributing; sorry this took a while, but there were some discussions before this; this work was done in #6441 (and some related PRs), so I'm closing this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
- What I did
Replaced uses of
github.com/pkg/errorsin this repo.That package has been archived for 2 years, after
fmt.Errorfadded support for wrapping errors with%win Go 1.13, more than 3 years ago.There are still indirect dependencies on
pkg/errorsvia github.com/docker/docker -- I can try to clean those up as well, if you're interested.- How I did it
Mostly I ran this: https://github.com/zchee/go-analyzer/tree/main/pkgerrors
In order to get that to work though, I first needed to find cases where
errors.Wrapwas called likeerrors.Wrap(err, msg)(wheremsgis an identifier and not a const string expression) orerrors.Wrap(err, foo())(wherefoois a method call and not a const string expression).After that I replaced any remaining
errors.Iscalls to use Go's stdliberrors.Is, which now works with the%wadded by the analyzer- How to verify it
Thorough code review and reliance on tests
- Description for the changelog
Remove use of deprecated/archived module github.com/pkg/errors
TODO (if you're interested in proceeding)
fmt.Errorfwith capitalized message trips the linter