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

github.com/pkg/errors is in maintenance mode #175

Closed
klmitch opened this issue Apr 11, 2023 · 7 comments
Closed

github.com/pkg/errors is in maintenance mode #175

klmitch opened this issue Apr 11, 2023 · 7 comments

Comments

@klmitch
Copy link

klmitch commented Apr 11, 2023

While investigating this package as a possible solution, I noticed that it is using github.com/pkg/errors. This package has been archived, presumably because go 1.13 now natively provides the bulk of the functionality that this errors package used to provide. Given that go 1.20 is now out, it would probably be worthwhile to update the interface accordingly.

@tiraboschi
Copy link

+1

@mitar
Copy link

mitar commented Oct 9, 2023

Shameless plug: you can also switch it to drop-in replacement gitlab.com/tozd/go/errors. It fixes many issues, is maintained, and supports modern Go's error patterns (sentinel errors, %w formatting, joined errors, etc.). It also provides some nice utility functions and structured details so that it is easy to extract dynamic data out of errors (instead of trying to get them out of formatted strings). Has improved error formatting and JSON marshaling of errors. It is interoperable with other errors packages and does not require a dependency on itself to extract data (e.g., stack trace) from errors.

@evanphx
Copy link
Owner

evanphx commented Oct 9, 2023

I don't really see a reason to switch honestly. Sure it's it maintenance mode, but it's not hurting anything. What would be gained by changing?

@tiraboschi
Copy link

For instance you will be able to correctly use errors.As from the standard golang "errors"

@evanphx
Copy link
Owner

evanphx commented Oct 9, 2023

That's only for the code within json-patch to use As. Is there a place where you think that's warranted? I don't recall want to do an upgrade just for upgrades sake unless there are reasons that improve the functionality of the code.

@tiraboschi
Copy link

For instance we are validating a set of patches in advance before applying all or them or nothing and we want to ignore/tolerate failures on test operations.

Currently we are doing:

	// tolerate jsonpatch test failures
	if err != nil && !errors.Is(errors.Unwrap(err), jsonpatch.ErrTestFailed) {
		return err
	}

as errors.As from "errors" is not working in that case.

Another option would be about introducing something like AllowMissingPathOnTest or AllowTestFailures in jsonpatch.ApplyOptions.

@evanphx
Copy link
Owner

evanphx commented Jan 12, 2024

I prefer errors.Wrapf as an API honestly, so I think I'm just going to keep it for now.

@evanphx evanphx closed this as completed Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants