Currently errors & pkg/errors are used interchangeably.
Migrate all error handling to errors pkg and/or fmt.Errorf("... %w", err).
once this is completed this linter can be enabled https://github.com/Djarvur/go-err113
We don't use fmt.Errorf("... %w", err), but we should stick to a single package 馃憤
errors.Wrap is used:
https://github.com/cosmos/cosmos-sdk/blob/master/x/genutil/client/cli/gentx.go#L77
https://github.com/cosmos/cosmos-sdk/blob/master/x/genutil/client/cli/gentx.go#L99
and other places, i meant these should be replaced with fmt.Errorf("... %w", err)
Is anyone else working on this? I think this is something I'd like to help with.
Go for it!! No one is currently working on this
Do y'all prefer whether I switch to pkg/errors or errors?
Yes please
Which one?
'errors' sorry was quick to answer
errors does not have errors.Cause() or errors.StackTrace or errors.Frame, but pkg/errors does. Maybe we should use pkg/errors instead or implement our own Cause, StackTrace, and Frame or find a way where using these types/functions isn't necessary? I don't want to change any code architecture without approval, so I listed where each are used here:
errors.Cause
https://github.com/cosmos/cosmos-sdk/blob/fe9fe8769390d382bffa3ef1e372c30eaa7c192c/store/iavl/store.go#L140
errors.StackTrace
https://github.com/cosmos/cosmos-sdk/blob/fe9fe8769390d382bffa3ef1e372c30eaa7c192c/types/errors/stacktrace.go#L46
https://github.com/cosmos/cosmos-sdk/blob/fe9fe8769390d382bffa3ef1e372c30eaa7c192c/types/errors/stacktrace.go#L105
errors.Frame
https://github.com/cosmos/cosmos-sdk/blob/fe9fe8769390d382bffa3ef1e372c30eaa7c192c/types/errors/stacktrace.go#L12
https://github.com/cosmos/cosmos-sdk/blob/fe9fe8769390d382bffa3ef1e372c30eaa7c192c/types/errors/stacktrace.go#L23
https://github.com/cosmos/cosmos-sdk/blob/fe9fe8769390d382bffa3ef1e372c30eaa7c192c/types/errors/stacktrace.go#L34
I don't see any harm in sticking with pkg/errors. Best not to potentially introduce bugs 馃憤
types/errors/errors_test.go seems to be testing the differences between errors and pkg/errors. Is there something else that should happen here?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.