Add github.com/cockroachdb/errors to hooks as alternative errors package#413
Conversation
|
@yuxincs friendly ping now that I've got CLA sign-off here 🙂 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #413 +/- ##
=======================================
Coverage 87.25% 87.25%
=======================================
Files 72 72
Lines 8306 8306
=======================================
Hits 7247 7247
Misses 867 867
Partials 192 192 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| { | ||
| kind: _func, | ||
| enclosingRegex: regexp.MustCompile(`^(stubs/)?github\.com/cockroachdb/errors$`), | ||
| funcNameRegex: regexp.MustCompile(`^Newf$`), |
There was a problem hiding this comment.
We can probably merge this with the above with a (f)?
| // nilable(result 0) | ||
| func New(text string) error { return nil } | ||
|
|
||
| // nilable(errs[], result 0) | ||
| func Join(errs ...error) error { return nil } |
There was a problem hiding this comment.
These two actually return nonnil error per contract, could you update the stubs and annotations here?
There was a problem hiding this comment.
I think I've corrected this, but not positive I did it right. Would appreciate another look!
|
@ian-oneleet Hey, thanks for the contributions! I made two minor comments, could you take a look and see if they make sense? they should be simple fixes. After that I'll merge :) |
https://github.com/cockroachdb/errors is a popular alternative to the stdlib
errorspackage. It provides alternative versions oferrors.New,fmt.Errorf(which it callserrors.Newf), anderrors.Join, among other functions.Nilaway currently flags more false positives for codebases that use
cockroachdb/errorsinstead of stdliberrors, because the built-in special cases for stdliberrorsdon't carry over tocockroachdb/errors. This PR duplicates the special cases inhook/assume_return.goandhook/replace_conditional.goso that they work withcockroachdb/errors.Code was produced with LLM assistance (Claude).