Skip to content

Commit 8b3fa67

Browse files
committed
Replace deprecated linter and address warnings
1 parent ff6c49e commit 8b3fa67

File tree

4 files changed

+5
-17
lines changed

4 files changed

+5
-17
lines changed

.golangci.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ linters:
1414
- dogsled
1515
- dupl
1616
- errcheck
17-
- exportloopref
17+
- copyloopvar
1818
- gochecknoinits
1919
- goconst
2020
- gocritic
@@ -46,6 +46,8 @@ linters-settings:
4646
line-length: 170
4747
gocyclo:
4848
min-complexity: 30
49+
copyloopvar:
50+
check-alias: true
4951

5052
issues:
5153
# List of regexps of issue texts to exclude, empty list by default.
@@ -54,4 +56,4 @@ issues:
5456
# excluded by default patterns execute `golangci-lint run --help`
5557
exclude:
5658
- "Using the variable on range scope `tc` in function literal"
57-
- "unused-parameter: parameter"
59+
- "unused-parameter: parameter"

pkg/kstatus/polling/collector/collector_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@ func TestCollectorEventProcessing(t *testing.T) {
157157
if e.Resource != nil {
158158
latestEventByIdentifier[e.Resource.Identifier] = e
159159
}
160-
ev := e
161-
latestEvent = &ev
160+
latestEvent = &e
162161
eventCh <- e
163162
}
164163
// Give the collector some time to process the event.

pkg/kstatus/status/status_augment_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ func TestAugmentConditions(t *testing.T) {
132132
}
133133

134134
for tn, tc := range testCases {
135-
tc := tc
136135
t.Run(tn, func(t *testing.T) {
137136
u := y2u(t, tc.manifest)
138137
addConditions(t, u, tc.withConditions)

pkg/kstatus/status/status_compute_test.go

-12
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ func TestPodStatus(t *testing.T) {
249249
}
250250

251251
for tn, tc := range testCases {
252-
tc := tc
253252
t.Run(tn, func(t *testing.T) {
254253
runStatusTest(t, tc)
255254
})
@@ -300,7 +299,6 @@ func TestPVCStatus(t *testing.T) {
300299
}
301300

302301
for tn, tc := range testCases {
303-
tc := tc
304302
t.Run(tn, func(t *testing.T) {
305303
runStatusTest(t, tc)
306304
})
@@ -462,7 +460,6 @@ func TestStsStatus(t *testing.T) {
462460
}
463461

464462
for tn, tc := range testCases {
465-
tc := tc
466463
t.Run(tn, func(t *testing.T) {
467464
runStatusTest(t, tc)
468465
})
@@ -624,7 +621,6 @@ func TestDaemonsetStatus(t *testing.T) {
624621
}
625622

626623
for tn, tc := range testCases {
627-
tc := tc
628624
t.Run(tn, func(t *testing.T) {
629625
runStatusTest(t, tc)
630626
})
@@ -784,7 +780,6 @@ func TestDeploymentStatus(t *testing.T) {
784780
}
785781

786782
for tn, tc := range testCases {
787-
tc := tc
788783
t.Run(tn, func(t *testing.T) {
789784
runStatusTest(t, tc)
790785
})
@@ -961,7 +956,6 @@ func TestReplicasetStatus(t *testing.T) {
961956
}
962957

963958
for tn, tc := range testCases {
964-
tc := tc
965959
t.Run(tn, func(t *testing.T) {
966960
runStatusTest(t, tc)
967961
})
@@ -1016,7 +1010,6 @@ func TestPDBStatus(t *testing.T) {
10161010
}
10171011

10181012
for tn, tc := range testCases {
1019-
tc := tc
10201013
t.Run(tn, func(t *testing.T) {
10211014
runStatusTest(t, tc)
10221015
})
@@ -1144,7 +1137,6 @@ func TestCRDGenericStatus(t *testing.T) {
11441137
}
11451138

11461139
for tn, tc := range testCases {
1147-
tc := tc
11481140
t.Run(tn, func(t *testing.T) {
11491141
runStatusTest(t, tc)
11501142
})
@@ -1262,7 +1254,6 @@ func TestJobStatus(t *testing.T) {
12621254
}
12631255

12641256
for tn, tc := range testCases {
1265-
tc := tc
12661257
t.Run(tn, func(t *testing.T) {
12671258
runStatusTest(t, tc)
12681259
})
@@ -1311,7 +1302,6 @@ func TestCronJobStatus(t *testing.T) {
13111302
}
13121303

13131304
for tn, tc := range testCases {
1314-
tc := tc
13151305
t.Run(tn, func(t *testing.T) {
13161306
runStatusTest(t, tc)
13171307
})
@@ -1404,7 +1394,6 @@ func TestServiceStatus(t *testing.T) {
14041394
}
14051395

14061396
for tn, tc := range testCases {
1407-
tc := tc
14081397
t.Run(tn, func(t *testing.T) {
14091398
runStatusTest(t, tc)
14101399
})
@@ -1516,7 +1505,6 @@ func TestCRDStatus(t *testing.T) {
15161505
}
15171506

15181507
for tn, tc := range testCases {
1519-
tc := tc
15201508
t.Run(tn, func(t *testing.T) {
15211509
runStatusTest(t, tc)
15221510
})

0 commit comments

Comments
 (0)