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/errors
in this repo.That package has been archived for 2 years, after
fmt.Errorf
added support for wrapping errors with%w
in Go 1.13, more than 3 years ago.There are still indirect dependencies on
pkg/errors
via 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.Wrap
was called likeerrors.Wrap(err, msg)
(wheremsg
is an identifier and not a const string expression) orerrors.Wrap(err, foo())
(wherefoo
is a method call and not a const string expression).After that I replaced any remaining
errors.Is
calls to use Go's stdliberrors.Is
, which now works with the%w
added 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.Errorf
with capitalized message trips the linter