-
Notifications
You must be signed in to change notification settings - Fork 61
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 log.Error to ensure proper logging and add custom linter to avoid this scenario in the future #1599
🐛 Fix: Prevent nil errors in log.Error to ensure proper logging and add custom linter to avoid this scenario in the future #1599
Conversation
✅ Deploy Preview for olmv1 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
27f6d94
to
287b0a0
Compare
287b0a0
to
c597f22
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1599 +/- ##
==========================================
- Coverage 68.26% 67.85% -0.42%
==========================================
Files 58 60 +2
Lines 4995 5096 +101
==========================================
+ Hits 3410 3458 +48
- Misses 1343 1388 +45
- Partials 242 250 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
11b2c46
to
a66fb03
Compare
hack/ci/custom-linters/setuplognilerrorcheck/setuplognilerrorcheck.go
Outdated
Show resolved
Hide resolved
hack/ci/custom-linters/setuplognilerrorcheck/setuplognilerrorcheck.go
Outdated
Show resolved
Hide resolved
Makefile
Outdated
.PHONY: lint-custom | ||
lint-custom: custom-linter-build | ||
go vet -vettool=./bin/custom-linter ./... |
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.
golangci-lint
should already be running go vet
(assuming the govet
linter is enabled). So I think we get this part automatically if we add the directory where we build the linter binary to the path for the golangci-lint run
command.
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.
See https://golangci-lint.run/contributing/new-linters/
But I could not make it work.
I would need to spend more time on that.
Could we move forward with this one as it is and then track a task for we see if we can integrate it with golangci as a follow up?
At least now we have the logs fixed + the linter
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.
Created : #1775
a66fb03
to
3cf6f40
Compare
3cf6f40
to
82bf4f7
Compare
8ff0dce
to
e534524
Compare
c4b2d95
to
2ba109f
Compare
/lgtm |
64b9ee8
to
baee741
Compare
baee741
to
f2c857d
Compare
@tmshort rebased :-) |
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.
There should also be an even number (2, 4, 6, etc) of arguments to log.Error():
- Arg 1: error type
- Arg 2: message
- Arg 3+4: key1+value1
- Arg 5+6: key2+value2
etc.
Is it possible to check that?
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.
Done for all that does not fail to build already. See that:
Arg 2: message -> will fail to build
Arg 1: error type -> will fail to build / accept only nil or error
9c6c0ac
to
6cfe172
Compare
….) calls and fix found linter issues. Fix: Prevent nil errors in setupLog.Error to ensure proper logging Closes; operator-framework#1566 Closes: operator-framework#1556 Furthermore, it solves a similar scenario in the EventHandler code implementation found with the new custom linter check.
6cfe172
to
457edd9
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
4304961
Description
Solves the following issues and add a custom linter to avoid this scenario in the future:
Furthermore, it solves a similar scenario in the EventHandler code implementation found with the new custom linter check.
Example os usage:
Reviewer Checklist