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

Remove use of deprecated package pkg/errors #5269

Open
1 task done
lukemassa opened this issue Jan 24, 2025 · 0 comments
Open
1 task done

Remove use of deprecated package pkg/errors #5269

lukemassa opened this issue Jan 24, 2025 · 0 comments
Labels
feature New functionality/enhancement

Comments

@lukemassa
Copy link
Contributor

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.

@lukemassa lukemassa added the feature New functionality/enhancement label Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New functionality/enhancement
Projects
None yet
Development

No branches or pull requests

1 participant