-
Notifications
You must be signed in to change notification settings - Fork 58
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 sanity check and add custom linter to avoid this scenario in the future #1599
base: main
Are you sure you want to change the base?
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 67.66% 67.27% -0.39%
==========================================
Files 59 59
Lines 4991 5012 +21
==========================================
- Hits 3377 3372 -5
- Misses 1367 1392 +25
- Partials 247 248 +1
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
a66fb03
to
3cf6f40
Compare
3cf6f40
to
82bf4f7
Compare
8ff0dce
to
e534524
Compare
c4b2d95
to
2ba109f
Compare
2ba109f
to
b19603a
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.
Pretty neat. Looks like @joelanford's already helped get this PR to a good state with his initial reviews.
/lgtm
so that Joe can approve :)
hack/ci/custom-linters/setuplognilerrorcheck/setuplognilerrorcheck.go
Outdated
Show resolved
Hide resolved
hack/ci/custom-linters/setuplognilerrorcheck/setuplognilerrorcheck.go
Outdated
Show resolved
Hide resolved
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.
Nice! You found a few other places we needed to fix as well!
b19603a
to
0a5c8d9
Compare
New changes are detected. LGTM label has been removed. |
557bae5
to
fa0be14
Compare
fa0be14
to
5a41f9f
Compare
.PHONY: custom-linter-build | ||
LINTER_DIR := ./hack/ci/custom-linters/cmd | ||
custom-linter-build: # HELP Build custom linter | ||
cd $(LINTER_DIR) && go build -tags '$(GO_BUILD_TAGS)' -o $(ROOT_DIR)/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.
@joelanford you suggested
go build ./hack/ci/custom-linters/cmd/ -o ./bin/custom-linter
But it does not work.
.PHONY: custom-linter-build
LINTER_DIR := hack/ci/custom-linters
custom-linter-build: # HELP Build custom linter
go build -tags '$(GO_BUILD_TAGS)' -o $(ROOT_DIR)/bin/custom-linter $(ROOT_DIR)/$(LINTER_DIR)/cmd
make custom-linter-build
go build -tags 'containers_image_openpgp' -o /Users/camilam/go/src/github/operator-framework/operator-controller/bin/custom-linter /Users/camilam/go/src/github/operator-framework/operator-controller/hack/ci/custom-linters/cmd
main module (github.com/operator-framework/operator-controller) does not contain package github.com/operator-framework/operator-controller/hack/ci/custom-linters/cmd
make: *** [custom-linter-build] Error 1
I am missing something silly here.
but anyway that does not seems to be a big deal.
Hi @joelanford IHMO we can improve more here. However, wdyt is that acceptable to get merged and when we have time, can we work more on this one? |
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.
Reviewer Checklist