Skip to content

Commit 7112d14

Browse files
committed
fixed for loops alias
aliasing in for loops no longer needed as per https://go.dev/blog/loopvar-preview Signed-off-by: Mattia Lavacca <[email protected]>
1 parent 56da781 commit 7112d14

File tree

11 files changed

+0
-19
lines changed

11 files changed

+0
-19
lines changed

apis/v1/util/validation/gatewayclass_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ func TestIsControllerNameValid(t *testing.T) {
5757
}
5858

5959
for _, tc := range testCases {
60-
tc := tc
6160
t.Run(tc.name, func(t *testing.T) {
6261
isValid := validationtutils.IsControllerNameValid(tc.controllerName)
6362
if isValid != tc.isvalid {

apis/v1beta1/util/validation/gatewayclass_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ func TestIsControllerNameValid(t *testing.T) {
5757
}
5858

5959
for _, tc := range testCases {
60-
tc := tc
6160
t.Run(tc.name, func(t *testing.T) {
6261
isValid := validationtutils.IsControllerNameValid(tc.controllerName)
6362
if isValid != tc.isvalid {

conformance/tests/gateway-invalid-tls-configuration.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ var GatewayInvalidTLSConfiguration = suite.ConformanceTest{
7777
}
7878

7979
for _, tc := range testCases {
80-
tc := tc
8180
t.Run(tc.name, func(t *testing.T) {
8281
t.Parallel()
8382
kubernetes.GatewayStatusMustHaveListeners(t, s.Client, s.TimeoutConfig, tc.gatewayNamespacedName, listeners)

conformance/utils/kubernetes/apply.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,6 @@ func (a Applier) prepareResources(t *testing.T, decoder *yaml.YAMLOrJSONDecoder)
216216

217217
func (a Applier) MustApplyObjectsWithCleanup(t *testing.T, c client.Client, timeoutConfig config.TimeoutConfig, resources []client.Object, cleanup bool) {
218218
for _, resource := range resources {
219-
resource := resource
220-
221219
ctx, cancel := context.WithTimeout(context.Background(), timeoutConfig.CreateTimeout)
222220
defer cancel()
223221

conformance/utils/kubernetes/helpers.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ func NamespacesMustBeReady(t *testing.T, c client.Client, timeoutConfig config.T
206206
tlog.Errorf(t, "Error listing Gateways: %v", err)
207207
}
208208
for _, gw := range gwList.Items {
209-
gw := gw
210209

211210
if val, ok := gw.Annotations[GatewayExcludedFromReadinessChecks]; ok && val == "true" {
212211
tlog.Logf(t, "Gateway %s is skipped for setup and wont be tested", client.ObjectKeyFromObject(&gw))
@@ -237,7 +236,6 @@ func NamespacesMustBeReady(t *testing.T, c client.Client, timeoutConfig config.T
237236
tlog.Errorf(t, "Error listing Pods: %v", err)
238237
}
239238
for _, pod := range podList.Items {
240-
pod := pod
241239
if !findPodConditionInList(t, pod.Status.Conditions, "Ready", "True") &&
242240
pod.Status.Phase != v1.PodSucceeded &&
243241
pod.DeletionTimestamp == nil {
@@ -309,7 +307,6 @@ func MeshNamespacesMustBeReady(t *testing.T, c client.Client, timeoutConfig conf
309307
tlog.Errorf(t, "Error listing Pods: %v", err)
310308
}
311309
for _, pod := range podList.Items {
312-
pod := pod
313310
if !findPodConditionInList(t, pod.Status.Conditions, "Ready", "True") &&
314311
pod.Status.Phase != v1.PodSucceeded &&
315312
pod.DeletionTimestamp == nil {

conformance/utils/kubernetes/helpers_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ func Test_listenersMatch(t *testing.T) {
313313
}
314314

315315
for _, test := range tests {
316-
test := test
317316
t.Run(test.name, func(t *testing.T) {
318317
assert.Equal(t, test.want, listenersMatch(t, test.expected, test.actual))
319318
})

conformance/utils/suite/reports_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ func TestBuildSummary(t *testing.T) {
114114

115115
for _, tc := range testCases {
116116
t.Run(tc.name, func(t *testing.T) {
117-
tc := tc
118117
summary := buildSummary(tc.report)
119118
require.Equal(t, tc.expectedSummary, summary)
120119
})

conformance/utils/suite/suite_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ func TestGetAPIVersionAndChannel(t *testing.T) {
168168
}
169169

170170
for _, tc := range testCases {
171-
tc := tc
172171
t.Run(tc.name, func(t *testing.T) {
173172
version, channel, err := getAPIVersionAndChannel(tc.crds)
174173
assert.Equal(t, tc.expectedVersion, version)

gwctl/pkg/printer/gatewayclasses_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,6 @@ Events: <none>
316316
}
317317

318318
for _, tc := range testcases {
319-
tc := tc
320319
t.Run(tc.name, func(t *testing.T) {
321320
k8sClients := common.MustClientsForTest(t, tc.objects...)
322321
policyManager := utils.MustPolicyManagerForTest(t, k8sClients)

gwctl/pkg/resourcediscovery/resourcemodel.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ func (rm *ResourceModel) addGatewayClasses(gatewayClasses ...gatewayv1.GatewayCl
5555
rm.GatewayClasses = make(map[gatewayClassID]*GatewayClassNode)
5656
}
5757
for _, gatewayClass := range gatewayClasses {
58-
gatewayClass := gatewayClass
5958
gatewayClassNode := NewGatewayClassNode(&gatewayClass)
6059
if _, ok := rm.GatewayClasses[gatewayClassNode.ID()]; !ok {
6160
rm.GatewayClasses[gatewayClassNode.ID()] = gatewayClassNode
@@ -82,7 +81,6 @@ func (rm *ResourceModel) addGateways(gateways ...gatewayv1.Gateway) {
8281
rm.Gateways = make(map[gatewayID]*GatewayNode)
8382
}
8483
for _, gateway := range gateways {
85-
gateway := gateway
8684
gatewayNode := NewGatewayNode(&gateway)
8785
if _, ok := rm.Gateways[gatewayNode.ID()]; !ok {
8886
rm.Gateways[gatewayNode.ID()] = gatewayNode
@@ -96,7 +94,6 @@ func (rm *ResourceModel) addHTTPRoutes(httpRoutes ...gatewayv1.HTTPRoute) {
9694
rm.HTTPRoutes = make(map[httpRouteID]*HTTPRouteNode)
9795
}
9896
for _, httpRoute := range httpRoutes {
99-
httpRoute := httpRoute
10097
httpRouteNode := NewHTTPRouteNode(&httpRoute)
10198
if _, ok := rm.HTTPRoutes[httpRouteNode.ID()]; !ok {
10299
rm.HTTPRoutes[httpRouteNode.ID()] = httpRouteNode
@@ -110,7 +107,6 @@ func (rm *ResourceModel) addBackends(backends ...unstructured.Unstructured) {
110107
rm.Backends = make(map[backendID]*BackendNode)
111108
}
112109
for _, backend := range backends {
113-
backend := backend
114110
backendNode := NewBackendNode(&backend)
115111
if _, ok := rm.Backends[backendNode.ID()]; !ok {
116112
rm.Backends[backendNode.ID()] = backendNode
@@ -124,7 +120,6 @@ func (rm *ResourceModel) addReferenceGrants(referenceGrants ...gatewayv1beta1.Re
124120
rm.ReferenceGrants = make(map[referenceGrantID]*ReferenceGrantNode)
125121
}
126122
for _, referenceGrant := range referenceGrants {
127-
referenceGrant := referenceGrant
128123
referenceGrantNode := NewReferenceGrantNode(&referenceGrant)
129124
if _, ok := rm.ReferenceGrants[referenceGrantNode.ID()]; !ok {
130125
rm.ReferenceGrants[referenceGrantNode.ID()] = referenceGrantNode
@@ -140,7 +135,6 @@ func (rm *ResourceModel) addPolicyIfTargetExists(policies ...policymanager.Polic
140135
rm.Policies = make(map[policyID]*PolicyNode)
141136
}
142137
for _, policy := range policies {
143-
policy := policy
144138
policyNode := NewPolicyNode(&policy)
145139

146140
switch {

0 commit comments

Comments
 (0)