Skip to content

Commit 8002f2e

Browse files
committed
Remove deprecated linter and fix issues (nginx#2433)
1 parent 143a82e commit 8002f2e

File tree

20 files changed

+6
-34
lines changed

20 files changed

+6
-34
lines changed

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ linters:
5353
enable:
5454
- asasalint
5555
- asciicheck
56+
- copyloopvar
5657
- dupword
5758
- errcheck
5859
- errname
5960
- errorlint
60-
- exportloopref
6161
- fatcontext
6262
- ginkgolinter
6363
- gocheckcompilerdirectives

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ repos:
4141
- javascript
4242

4343
- repo: https://github.com/golangci/golangci-lint
44-
rev: v1.59.1
44+
rev: v1.60.2
4545
hooks:
4646
- id: golangci-lint-full
4747
name: golangci-lint-root

cmd/gateway/commands_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ func TestCommonFlagsValidation(t *testing.T) {
133133
}
134134

135135
for _, test := range tests {
136-
test := test
137136
t.Run(test.name+"_static_mode", func(t *testing.T) {
138137
t.Parallel()
139138
testFlag(t, createStaticModeCommand(), test)
@@ -387,7 +386,6 @@ func TestStaticModeCmdFlagValidation(t *testing.T) {
387386
// common flags validation is tested separately
388387

389388
for _, test := range tests {
390-
test := test
391389
t.Run(test.name, func(t *testing.T) {
392390
t.Parallel()
393391
cmd := createStaticModeCommand()
@@ -461,7 +459,6 @@ func TestSleepCmdFlagValidation(t *testing.T) {
461459
}
462460

463461
for _, test := range tests {
464-
test := test
465462
t.Run(test.name, func(t *testing.T) {
466463
t.Parallel()
467464
cmd := createSleepCommand()

cmd/gateway/validation_test.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ func TestValidateGatewayControllerName(t *testing.T) {
5252
}
5353

5454
for _, test := range tests {
55-
test := test
5655
t.Run(test.name, func(t *testing.T) {
5756
t.Parallel()
5857
g := NewWithT(t)
@@ -118,7 +117,6 @@ func TestValidateResourceName(t *testing.T) {
118117
}
119118

120119
for _, test := range tests {
121-
test := test
122120
t.Run(test.name, func(t *testing.T) {
123121
t.Parallel()
124122
g := NewWithT(t)
@@ -184,7 +182,6 @@ func TestValidateNamespaceName(t *testing.T) {
184182
}
185183

186184
for _, test := range tests {
187-
test := test
188185
t.Run(test.name, func(t *testing.T) {
189186
t.Parallel()
190187
g := NewWithT(t)
@@ -249,7 +246,6 @@ func TestParseNamespacedResourceName(t *testing.T) {
249246
}
250247

251248
for _, test := range tests {
252-
test := test
253249
t.Run(test.name, func(t *testing.T) {
254250
t.Parallel()
255251
g := NewWithT(t)
@@ -317,7 +313,6 @@ func TestValidateQualifiedName(t *testing.T) {
317313
}
318314

319315
for _, test := range tests {
320-
test := test
321316
t.Run(test.name, func(t *testing.T) {
322317
t.Parallel()
323318
g := NewWithT(t)
@@ -382,7 +377,6 @@ func TestValidateURL(t *testing.T) {
382377
}
383378

384379
for _, tc := range tests {
385-
tc := tc
386380
t.Run(tc.name, func(t *testing.T) {
387381
t.Parallel()
388382
g := NewWithT(t)
@@ -425,7 +419,6 @@ func TestValidateIP(t *testing.T) {
425419
}
426420

427421
for _, tc := range tests {
428-
tc := tc
429422
t.Run(tc.name, func(t *testing.T) {
430423
t.Parallel()
431424
g := NewWithT(t)
@@ -495,7 +488,6 @@ func TestValidateEndpoint(t *testing.T) {
495488
}
496489

497490
for _, tc := range tests {
498-
tc := tc
499491
t.Run(tc.name, func(t *testing.T) {
500492
t.Parallel()
501493
g := NewWithT(t)
@@ -535,7 +527,6 @@ func TestValidatePort(t *testing.T) {
535527
}
536528

537529
for _, tc := range tests {
538-
tc := tc
539530
t.Run(tc.name, func(t *testing.T) {
540531
t.Parallel()
541532
g := NewWithT(t)

internal/framework/controller/filter/filter_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ func TestCreateSingleResourceFilter(t *testing.T) {
5151
}
5252

5353
for _, test := range tests {
54-
test := test
5554
t.Run(test.name, func(t *testing.T) {
5655
t.Parallel()
5756
g := NewWithT(t)

internal/framework/controller/index/endpointslice_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ func TestServiceNameIndexFunc(t *testing.T) {
4343
}
4444

4545
for _, tc := range testcases {
46-
tc := tc
4746
t.Run(tc.msg, func(t *testing.T) {
4847
t.Parallel()
4948
g := NewWithT(t)

internal/framework/controller/predicate/annotation_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ func TestAnnotationPredicate_Create(t *testing.T) {
5959
p := AnnotationPredicate{Annotation: annotation}
6060

6161
for _, test := range tests {
62-
test := test
6362
t.Run(test.name, func(t *testing.T) {
6463
t.Parallel()
6564
g := NewWithT(t)
@@ -215,7 +214,6 @@ func TestAnnotationPredicate_Update(t *testing.T) {
215214
p := AnnotationPredicate{Annotation: annotation}
216215

217216
for _, test := range tests {
218-
test := test
219217
t.Run(test.name, func(t *testing.T) {
220218
t.Parallel()
221219
g := NewWithT(t)

internal/framework/controller/predicate/service_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ func TestServicePortsChangedPredicate_Update(t *testing.T) {
228228
p := ServicePortsChangedPredicate{}
229229

230230
for _, tc := range testcases {
231-
tc := tc
232231
t.Run(tc.msg, func(t *testing.T) {
233232
t.Parallel()
234233
g := NewWithT(t)
@@ -445,7 +444,6 @@ func TestGatewayServicePredicate_Update(t *testing.T) {
445444
p := GatewayServicePredicate{NSName: types.NamespacedName{Namespace: "nginx-gateway", Name: "nginx"}}
446445

447446
for _, tc := range testcases {
448-
tc := tc
449447
t.Run(tc.msg, func(t *testing.T) {
450448
t.Parallel()
451449
g := NewWithT(t)

internal/framework/controller/register_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ func TestRegister(t *testing.T) {
121121
}
122122

123123
for _, test := range tests {
124-
test := test
125124
t.Run(test.msg, func(t *testing.T) {
126125
t.Parallel()
127126
g := NewWithT(t)

internal/framework/gatewayclass/validate_test.go

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

116116
for _, test := range tests {
117-
test := test
118117
t.Run(test.name, func(t *testing.T) {
119118
t.Parallel()
120119
g := NewWithT(t)

0 commit comments

Comments
 (0)