-
Notifications
You must be signed in to change notification settings - Fork 3.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
jobs: fix improperly wrapped errors #72351
Conversation
I'm working on a linter that detects errors that are not wrapped correctly, and it discovered these. Release note: None
ec20532
to
bf60012
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.
Reviewed 5 of 5 files at r1, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @adityamaru)
tftr! bors r=ajwerner |
Build succeeded: |
@rafiss just a headsup that this seems to have caused #72371 failures. The reason is that https://github.com/cockroachdb/cockroach/pull/72351/files#diff-6b2c8ccac0d3ee5f528d6661fcc9b37a032f7ac928cbfaebc72a05db34e47b4dR179 will now return nil if the err it is wrapping is nil. We do in fact want to return an error if we find a record, even if I'll send out a fix for this, but might be something to keep in mind when running the new linter! I (along with @miretskiy and @stevendanna) also feel that wrapping a nil error should be disallowed. While it saves a few lines of code it doesn't seem like a very desirable side effect? This might be a discussion for another issue. |
thanks for explaining @adityamaru ! I can add a thing to my linter to try to detect nil wrapped errors. to be fully robust to the problem, a nil-check could be added to the |
huh, no - it's a feature:
|
Nice. The |
I think that the argument is that while it is a feature, the cost isn't worth the benefit. That said, changing it would put us out-of-line with other similar functions in the Go ecosystem. |
:that: |
71877: lint: add new errwrap linter r=ajwerner,knz a=rafiss fixes #42510 This linter checks if we don't correctly wrap errors. The `/* nolint:errwrap */` comment can be used to disable the linter inline. See individual commits for mistakes this linter caught. It had already caught a few in #72353, #72352, #72351, #72350, and #72349. Release note: None Co-authored-by: Rafi Shamim <[email protected]>
refs #42510
I'm working on a linter that detects errors that are not wrapped
correctly, and it discovered these.
Release note: None