-
Notifications
You must be signed in to change notification settings - Fork 381
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
chore: enable copyloopvar lint #4047
Conversation
Signed-off-by: shawnh2 <[email protected]>
@@ -435,7 +433,7 @@ func (r *gatewayAPIReconciler) processBackendRefs(ctx context.Context, gwcResour | |||
backendRefKind, string(backendRef.Name)) | |||
} else { | |||
for _, endpointSlice := range endpointSliceList.Items { | |||
endpointSlice := endpointSlice | |||
endpointSlice := endpointSlice //nolint:copyloopvar |
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 kind of loopvar is needed since its address has been referenced
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4047 +/- ##
==========================================
+ Coverage 67.75% 67.78% +0.02%
==========================================
Files 187 187
Lines 22891 22865 -26
==========================================
- Hits 15509 15498 -11
+ Misses 6272 6257 -15
Partials 1110 1110 ☔ View full report in Codecov by Sentry. |
@@ -34,7 +34,7 @@ func (r *gatewayAPIReconciler) processTLSRoutes(ctx context.Context, gatewayName | |||
} | |||
|
|||
for _, tlsRoute := range tlsRouteList.Items { | |||
tlsRoute := tlsRoute | |||
tlsRoute := tlsRoute //nolint:copyloopvar |
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.
curious why its needed here ?
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.
same as #4047 (comment), in L95 it's referenced and got appended into resourceTree.TLSRoutes
.
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.
remove this will pass copyloopvar
, but not exportloopref
, becasue: exporting a pointer for the loop variable tlsRoute
/retest |
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 thanks !
What type of PR is this?
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #3244, replace & close #3959