Skip to content
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

Replace github.com/pkg/errors with stdlib errors #709

Closed
3 tasks
damiannolan opened this issue Jan 10, 2022 · 5 comments · Fixed by #775
Closed
3 tasks

Replace github.com/pkg/errors with stdlib errors #709

damiannolan opened this issue Jan 10, 2022 · 5 comments · Fixed by #775
Labels
good first issue Good for newcomers type: code hygiene Clean up code but without changing functionality or interfaces

Comments

@damiannolan
Copy link
Member

Summary

The package github.com/pkg/errors is hosted in an unmaintained and archived repository.
This package has been taken over and included within the Go standard library.

Proposal

Usage of github.com/pkg/errors should be replaced by the Go standard library package: errors.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged/assigned
@damiannolan damiannolan added good first issue Good for newcomers type: code hygiene Clean up code but without changing functionality or interfaces labels Jan 10, 2022
@dkmccandless
Copy link
Contributor

I'm interested in opening a PR (my first) to fix this issue, but I have been unable to push my branch to the repo. I'm guessing it's a question of access rights, which I'm not familiar with. If it wouldn't be out of place, please advise what I can do to contribute.

@crodriguezvega
Copy link
Contributor

crodriguezvega commented Jan 15, 2022

I'm interested in opening a PR (my first) to fix this issue, but I have been unable to push my branch to the repo. I'm guessing it's a question of access rights, which I'm not familiar with. If it wouldn't be out of place, please advise what I can do to contribute.

Thank you for your interest in contributing! The easiest for you would be to fork the repository and do the changes in a branch there. Once you're done you can open a PR to the main branch of this repository. If you are not familiar with this process, please check out GitHub's documentation on creating a pull request from a fork.

@dkmccandless
Copy link
Contributor

Calls to github.com/pkg/errors are being made in two files, modules/core/02-client/client/cli/tx.go and modules/core/03-connection/client/utils/utils.go. The calls in these files are to two functions:

  • errors.New: This is identical to the corresponding function in the standard library's errors package; the fix is trivial.
  • errors.Wrap: This functionality is subsumed in the standard library by fmt.Errorf's %w verb. fmt.Errorf("error message: %w", err) is equivalent to the old errors.Wrap(err, "error message").

github.com/pkg/errors remains as an indirect dependency in go.mod because it is used by cosmos-sdk.

@crodriguezvega
Copy link
Contributor

Thanks for the analysis! I think it should be fine to replace errors.Wrap with fmt.Errorf. What do you think, @colin-axner?

And if the Cosmos SDK uses github.com/pkg/errors then we will have to live with the transient dependency... But we can also open an issue in the SDK repository and ask to deprecate the usage of github.com/pkg/errors.

@colin-axner
Copy link
Contributor

All sounds good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers type: code hygiene Clean up code but without changing functionality or interfaces
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants