-
Notifications
You must be signed in to change notification settings - Fork 505
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
dependency with native error wrapping
#2549
Comments
Anyone willing to take up one of the above packages, please comment here with the package that you will refactor before starting to work on it. |
I can take up the ci-reporter, krel and kubepkg |
/assign (for tracking) |
I will take up: |
Folks, as @saschagrunert said in the third case above, pay attention to the following construct we sometimes have in the code. It was the one that broke krel in the reverted pr: // This would return nil or an error, so simple search and replace will not work:
return errors.Wrap(err, "XXXXX")
// It should instead be replaced with something like this:
if err != nil {
return fmt.Errorf("XXXXX: %w")
}
return nil |
I'll work on pkg/mail. |
I can work on |
I will take on |
/reopen |
@Priyankasaggu11929: Reopened this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Thank you all! We're almost done with this, just found one missing place in #2581 🙏 |
The PR #2478 got reverted because it caused troubles with the error wrapping conversion.
We should still do that, because the package
github.com/pkg/errors
is now in maintenance mode due to the golang native error wrapping. The goal is to do that on a package-by-package basis, where everyone is welcome to contribute.The basic conversion rules:
errors
import in favor ofgithub.com/pkg/errors
errors.Errorf
tofmt.Errorf
errors.Wrap(err, "…")
tofmt.Errorf("…: %w", err)
and check thaterr != nil
beforeerrors.Wrapf(err, "… %s: %s", foo, bar)
tofmt.Errorf("… %s: %s: %w", foo, bar err)
and check thaterr != nil
beforePackages to be converted:
The text was updated successfully, but these errors were encountered: