-
Notifications
You must be signed in to change notification settings - Fork 56
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
🐛 Fix: Prevent nil errors in setupLog.Error to ensure proper logging and add sanity check #1599
base: main
Are you sure you want to change the base?
🐛 Fix: Prevent nil errors in setupLog.Error to ensure proper logging and add sanity check #1599
Conversation
✅ Deploy Preview for olmv1 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
27f6d94
to
287b0a0
Compare
Add a check to be called in the verify where we can add adtional sanity checks to ensure the qiality of the project
287b0a0
to
c597f22
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.
Oh I like this!
Nit: I'd probably name this hack/ci/extra_linters.sh
Also nit: Is there a way to define the rules and messages such that they are setup as a list of pairs, and then we go ahead and write a loop to iterate and run each of them?
Lastly, I kinda wonder if there's already a generic regex-based linter built into golangci-lint that we could add custom rules to? 🤔
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.
Good points, I will try to check them out.
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.
We may also want to look into writing custom analyzers in Go using golang.org/x/tools/go/analysis
. As is, if we have a variable name for a logger that is not setupLog
, we'll miss it.
I assume an analyzer could find all logr.Logger.Error()
method usage where the first parameter is nil
.
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.
But now I'm getting really picky :)
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.
I think the idea of the custom analyse is nice
I will try it out.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1599 +/- ##
=======================================
Coverage 66.68% 66.68%
=======================================
Files 57 57
Lines 4584 4584
=======================================
Hits 3057 3057
Misses 1302 1302
Partials 225 225
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Description
Fix: Prevent nil errors in setupLog.Error to ensure proper logging
Closes; #1566
Closes: #1556
Reviewer Checklist