-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mechanical replacement of github.com/pkg/error with standard library …
…error handling This is not completely automatable here due to some semantic differences between errors.Wrap and fmt.Errorf with the %w verb; the latter will convert a nil error into a non-nil error, so this must be guarded with a nil error check. The mechanical transformation was done by running the following commands: gofmt -w -r 'errors.Errorf -> fmt.Errorf' . gofmt -w -r 'errors.Wrap(e, m) -> fmt.Errorf(m+": %w", e)' . gofmt -w -r 'errors.Wrapf(e, m) -> fmt.Errorf(m+": %w", e)' . gofmt -w -r 'errors.Wrapf(e, m, a) -> fmt.Errorf(m+": %w", a, e)' . gofmt -w -r 'errors.Wrapf(e, m, a, b) -> fmt.Errorf(m+": %w", a, b, e)' . gofmt -w -r 'errors.Wrapf(e, m, a, b, c) -> fmt.Errorf(m+": %w", a, b, c, e)' . find . -name '*.go' -exec gsed -i -e 's/"+": %w",/: %w",/g' '{}' \; find . -name '*.go' -exec gsed -i -e 's!"github.com/pkg/errors"$!"errors"!g' '{}' \; goimports -w . go mod tidy gofumpt -w . Replaying that will give the changes here modulo some manual changes that are made in the next commit. There should be no uses of %w in this change that are not guarded by a nil-check.
- Loading branch information
Showing
67 changed files
with
407 additions
and
418 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.