-
Notifications
You must be signed in to change notification settings - Fork 108
🐛 Update linters and fix reported issues #137
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
Conversation
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.
Thanks for improvement, overall looks good, 2 questions inline:
internal/controller/genericprovider/bootstrapprovider_wrapper.go
Outdated
Show resolved
Hide resolved
This commit enables additional linters and removes unused (commented) ones. All issues reported by linters are resolved either with "make lint-fix" or manually.
In golang the iteration variable is reused. At each iteration, the value of the next element in the range expression is assigned to the iteration variable; "provider" doesn't change, only its value changes. Hence, the expression &provider is referring to the same location in memory. The recommended solution for the issue is to redeclare "provider" inside the for loop. For more information: golang/go#56010 https://husni.dev/beware-of-implicit-memory-aliasing-in-go-foor-loop/
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.
This is a nice cleanup, thank you @Fedosin
/lgtm
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alexander-demicev The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
This PR enables additional linters and removes unused (commented) ones. All issues reported by linters are resolved either with "make lint-fix" or manually.
Noticeably, we fix implicit memory aliasing in for loops. In golang the iteration variable is reused. At each iteration, the value of the next element in the range expression is assigned to the iteration variable; "provider" doesn't change, only its value changes. Hence, the expression &provider is referring to the same location in memory.
The recommended solution for the issue is to redeclare "provider" inside the for loop.
For more information: golang/go#56010