NO-ISSUE: Drop github.com/pkg/errors - #3112
Conversation
|
@skitt: This pull request explicitly references no jira issue. DetailsIn 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 openshift-eng/jira-lifecycle-plugin repository. |
Summary by CodeRabbit
WalkthroughThe pull request removes the direct ChangesStandard-library error migration
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error)
✅ Passed checks (23 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
614386a to
91e28f2
Compare
|
@coderabbitai resume |
✅ Action performedReviews resumed. |
|
|
||
| import ( | ||
| "context" | ||
| "errors" |
There was a problem hiding this comment.
might as well replace the one errors.New() call with fmt.Errorf()
|
|
||
| "github.com/pkg/errors" | ||
| v1 "github.com/openshift/api/config/v1" | ||
| "github.com/openshift/cluster-network-operator/pkg/hypershift" |
There was a problem hiding this comment.
these are still out-of-place. (there are other CNO imports below)
There was a problem hiding this comment.
I’ve grouped them for now — I wasn’t able to determine from the rest of the project whether CNO imports are supposed to be in their own section; is that the case?
The module is deprecated and replaceable using stdlib constructs (with
differences around stacktrace handling which shouldn't be significant
here).
Mostly done using
git grep -l errors.Wrapf | xargs sed -i -E 's/errors.Wrapf\(err, "([^"]*)"([^)]*)\)/fmt.Errorf("\1: %w"\2, err)/'
git grep -l errors.Errorf | xargs sed -i 's/errors.Errorf/fmt.Errorf/'
git grep -l errors.Wrap | xargs sed -i -E 's/errors.Wrap\(err, "([^"]*)"\)/fmt.Errorf("\1: %w", err)/'
Some fmt.Errorf calls could be replaced by errors.New but the impact
is minimal (I can't find the reference right now, but the intention of
the Go authors is that fmt.Errorf can be used by default even when
formatting isn't needed; it means one less thing to think about when
the need for formatting changes).
A few capitalised error messages are fixed to start with lower-case.
Signed-off-by: Stephen Kitt <skitt@redhat.com>
|
/lgtm |
|
Scheduling required tests: Scheduling tests matching the |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: danwinship, skitt The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest |
|
/verified by CI |
|
@skitt: This PR has been marked as verified by DetailsIn 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 openshift-eng/jira-lifecycle-plugin repository. |
|
@skitt: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions 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-sigs/prow repository. I understand the commands that are listed here. |
Why
The module is deprecated and replaceable using stdlib constructs (with differences around stacktrace handling which shouldn't be significant here).
What
This was mostly done using
Some fmt.Errorf calls could be replaced by errors.New but the impact is minimal (I can't find the reference right now, but the intention of the Go authors is that fmt.Errorf can be used by default even when formatting isn't needed; it means one less thing to think about when the need for formatting changes).
Verification
This is a refactor with no functional changes, so most existing tests don’t need adjusting and should be sufficient to verify correctness. There is one behaviour change, related to error-message capitalisation; the corresponding test is adjusted to suit.