Skip to content

Remove use of deprecated package pkg/errors #5269

@lukemassa

Description

@lukemassa

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Describe the user story

Per, pkg/errors#245 github.com/pkg/errors is deprecated and read-only. Golang's standard library now has support for wrapping errors, so we can switch to that.

Another benefit if right now there's code that looks like:

		if !os.IsNotExist(err) {
			return valid.RepoCfg{}, errors.Wrapf(err, "unable to read %s file", repoConfigFile)
		}
		// Don't wrap os.IsNotExist errors because we want our callers to be
		// able to detect if it's a NotExist err.
		return valid.RepoCfg{}, err

Because later code calls os.IsNotExist on the error. The documentation for os.IsNotExist recommends using errors.Is(err, ErrNotExists, which can walk "up the chain" of a wrapped error, thus we can get rid of that entire block above.

Describe the solution you'd like
Eliminate pkg/errors as a dependency.

Describe the drawbacks of your solution
There are a lot of calls to errors.Wrapf() that will need to be changed, but I imagine it'll be pretty mechanical.
Another concern is a lot of merge conflicts because this code is all over the code base, hopefully we can find ways to chunk it up and/or do it quickly

Describe alternatives you've considered
There are other error wrapping packages we could use, but it seems like no reason not to just the one in the stdlib.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew functionality/enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions