Skip to content
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

Merged
merged 1 commit into from
Aug 15, 2024
Merged

Conversation

shawnh2
Copy link
Contributor

@shawnh2 shawnh2 commented Aug 14, 2024

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

@shawnh2 shawnh2 requested a review from a team as a code owner August 14, 2024 13:19
@@ -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
Copy link
Contributor Author

@shawnh2 shawnh2 Aug 14, 2024

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

Copy link

codecov bot commented Aug 14, 2024

Codecov Report

Attention: Patch coverage is 46.66667% with 8 lines in your changes missing coverage. Please review.

Project coverage is 67.78%. Comparing base (7078a03) to head (a1278d2).
Report is 7 commits behind head on main.

Files Patch % Lines
internal/provider/kubernetes/controller.go 11.11% 8 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

@@ -34,7 +34,7 @@ func (r *gatewayAPIReconciler) processTLSRoutes(ctx context.Context, gatewayName
}

for _, tlsRoute := range tlsRouteList.Items {
tlsRoute := tlsRoute
tlsRoute := tlsRoute //nolint:copyloopvar
Copy link
Contributor

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 ?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

@shawnh2
Copy link
Contributor Author

shawnh2 commented Aug 15, 2024

/retest

Copy link
Contributor

@arkodg arkodg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks !

@arkodg arkodg requested review from a team August 15, 2024 17:44
@arkodg arkodg merged commit 8ba1e0a into envoyproxy:main Aug 15, 2024
23 of 24 checks passed
@shawnh2 shawnh2 deleted the lint-loopvar branch August 16, 2024 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable loopvar feature of go for EG
3 participants