-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
Use errors.Is for error equality checks #18510
Conversation
Hi @redwrasse. Thanks for your PR. I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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-sigs/prow repository. |
/ok-to-test |
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files
... and 18 files with indirect coverage changes @@ Coverage Diff @@
## main #18510 +/- ##
==========================================
+ Coverage 68.79% 68.90% +0.11%
==========================================
Files 420 420
Lines 35489 35470 -19
==========================================
+ Hits 24413 24439 +26
+ Misses 9646 9609 -37
+ Partials 1430 1422 -8 Continue to review full report in Codecov by Sentry.
|
Looks like a failed lint test, I'll update the PR. |
3eb76c5
to
de84109
Compare
Hmm, failed integration tests https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/etcd-io_etcd/18510/pull-etcd-integration-1-cpu-amd64/1828914519779315712
Guessing this is just test flakiness? I'm not reproducing locally. |
/retest |
Hi @redwrasse, thanks for your pull request. I did a |
@ivanvc, nope, I had hoped to be thorough. Let me try to find the ones I missed. |
I found three additional There are a handful of cases in tests of the pattern |
@redwrasse, sorry for the back and forth sweat_smile: I should have probably given you the list of files since the beginning. So here are some others that I see after pulling your branch:
And matching
And the list is way longer than I expected. I didn't continue checking all of the Please let me know if the instances I found are not relevant to this change. |
@ivanvc thanks, my IDE search was not pulling these up for some reason. I'm happy to try to make the remaining changes in a separate follow-up PR, if you're fine with the scope of this current one. |
@redwrasse, what do you think if we scope it to the files you have already edited in this pull request? In that case, here's the list of missing ones (basically the
Thanks again, Samir! |
Sounds good! I'll do that. |
Alright, I believe the latest commit with the Hopefully, can get through the rest of them shortly in a separate PR. |
Thanks for addressing, @redwrasse. Can you squash your commits, please? Thanks again. |
Signed-off-by: redwrasse <[email protected]>
248824b
to
d4df7a9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks, Samir.
Perfect, I'll work on the rest of the cases as well as possibly the miscellaneous |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - Thanks for tidying these up @redwrasse. Happy to complete the remainder in subsequent pr's
cc @serathius, @ahrtr
Great, I tried to hopefully get the rest of the cases in #18551. |
Link to #18576. Do we have enough approvals to merge this? |
@serathius any comment or concern on this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No concerns.
Replacing err ==
with errors.Is
seems correct and safe enough that we can do it in bolk like this. Would be interesting if there is any static analysis that would highlight outdated comparison method.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ahrtr, ivanvc, jmhbnz, redwrasse, serathius The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
That's a good point. Without a static check, I'm sure we'll soon have newly written code checking errors with |
Update
err == *
expressions toerrors.Is(err, *)
, as a preferred means of error equality checks that can handle wrapping (https://pkg.go.dev/errors#pkg-overview).This PR updates all cases to be fixed in a number of files, but not all files. The rest of the cases should be addressed in a separate PR.