Skip to content

Commit 87dd8fe

Browse files
authored
exportloopref: deprecation (#4916)
1 parent af298e1 commit 87dd8fe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+11
-92
lines changed

.golangci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,16 @@ linters:
106106
disable-all: true
107107
enable:
108108
- bodyclose
109+
- copyloopvar
109110
- depguard
110111
- dogsled
111112
- dupl
112113
- errcheck
113114
- errorlint
114-
- exportloopref
115115
- funlen
116116
- gocheckcompilerdirectives
117117
- gochecknoinits
118+
- gochecknoinits
118119
- goconst
119120
- gocritic
120121
- gocyclo
@@ -126,6 +127,7 @@ linters:
126127
- gosec
127128
- gosimple
128129
- govet
130+
- intrange
129131
- ineffassign
130132
- lll
131133
- misspell

pkg/commands/config_verify.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ func printValidationDetail(cmd *cobra.Command, detail *jsonschema.Detailed) {
140140
}
141141

142142
for _, d := range detail.Errors {
143-
d := d
144143
printValidationDetail(cmd, &d)
145144
}
146145
}

pkg/commands/config_verify_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ func Test_createSchemaURL(t *testing.T) {
6363
}
6464

6565
for _, test := range testCases {
66-
test := test
6766
t.Run(test.desc, func(t *testing.T) {
6867
t.Parallel()
6968

@@ -126,7 +125,6 @@ func Test_createSchemaURL_error(t *testing.T) {
126125
}
127126

128127
for _, test := range testCases {
129-
test := test
130128
t.Run(test.desc, func(t *testing.T) {
131129
t.Parallel()
132130

pkg/commands/internal/builder_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ func Test_sanitizeVersion(t *testing.T) {
4545
}
4646

4747
for _, test := range testCases {
48-
test := test
4948
t.Run(test.desc, func(t *testing.T) {
5049
t.Parallel()
5150

pkg/commands/internal/configuration_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ func TestConfiguration_Validate(t *testing.T) {
4141
}
4242

4343
for _, test := range testCases {
44-
test := test
4544
t.Run(test.desc, func(t *testing.T) {
4645
t.Parallel()
4746

@@ -115,7 +114,6 @@ func TestConfiguration_Validate_error(t *testing.T) {
115114
}
116115

117116
for _, test := range testCases {
118-
test := test
119117
t.Run(test.desc, func(t *testing.T) {
120118
t.Parallel()
121119

pkg/config/config_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ func TestIsGoGreaterThanOrEqual(t *testing.T) {
7676
}
7777

7878
for _, test := range testCases {
79-
test := test
8079
t.Run(test.desc, func(t *testing.T) {
8180
t.Parallel()
8281

@@ -124,7 +123,6 @@ func Test_trimGoVersion(t *testing.T) {
124123
}
125124

126125
for _, test := range testCases {
127-
test := test
128126
t.Run(test.desc, func(t *testing.T) {
129127
t.Parallel()
130128

pkg/config/issues_test.go

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

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

@@ -194,7 +193,6 @@ func TestExcludeRule_Validate_error(t *testing.T) {
194193
}
195194

196195
for _, test := range testCases {
197-
test := test
198196
t.Run(test.desc, func(t *testing.T) {
199197
t.Parallel()
200198

pkg/config/linters_settings_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ func TestLintersSettings_Validate(t *testing.T) {
3333
}
3434

3535
for _, test := range testCases {
36-
test := test
3736
t.Run(test.desc, func(t *testing.T) {
3837
t.Parallel()
3938

@@ -74,7 +73,6 @@ func TestLintersSettings_Validate_error(t *testing.T) {
7473
}
7574

7675
for _, test := range testCases {
77-
test := test
7876
t.Run(test.desc, func(t *testing.T) {
7977
t.Parallel()
8078

@@ -112,7 +110,6 @@ func TestCustomLinterSettings_Validate(t *testing.T) {
112110
}
113111

114112
for _, test := range testCases {
115-
test := test
116113
t.Run(test.desc, func(t *testing.T) {
117114
t.Parallel()
118115

@@ -144,7 +141,6 @@ func TestCustomLinterSettings_Validate_error(t *testing.T) {
144141
}
145142

146143
for _, test := range testCases {
147-
test := test
148144
t.Run(test.desc, func(t *testing.T) {
149145
t.Parallel()
150146

@@ -181,7 +177,6 @@ func TestGovetSettings_Validate(t *testing.T) {
181177
}
182178

183179
for _, test := range testCases {
184-
test := test
185180
t.Run(test.desc, func(t *testing.T) {
186181
t.Parallel()
187182

@@ -224,7 +219,6 @@ func TestGovetSettings_Validate_error(t *testing.T) {
224219
}
225220

226221
for _, test := range testCases {
227-
test := test
228222
t.Run(test.desc, func(t *testing.T) {
229223
t.Parallel()
230224

pkg/config/linters_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ func TestLinters_validateDisabledAndEnabledAtOneMoment(t *testing.T) {
4242
}
4343

4444
for _, test := range testCases {
45-
test := test
4645
t.Run(test.desc, func(t *testing.T) {
4746
t.Parallel()
4847

@@ -77,7 +76,6 @@ func TestLinters_validateDisabledAndEnabledAtOneMoment_error(t *testing.T) {
7776
}
7877

7978
for _, test := range testCases {
80-
test := test
8179
t.Run(test.desc, func(t *testing.T) {
8280
t.Parallel()
8381

@@ -138,7 +136,6 @@ func TestLinters_validateAllDisableEnableOptions(t *testing.T) {
138136
}
139137

140138
for _, test := range testCases {
141-
test := test
142139
t.Run(test.desc, func(t *testing.T) {
143140
t.Parallel()
144141

@@ -201,7 +198,6 @@ func TestLinters_validateAllDisableEnableOptions_error(t *testing.T) {
201198
}
202199

203200
for _, test := range testCases {
204-
test := test
205201
t.Run(test.desc, func(t *testing.T) {
206202
t.Parallel()
207203

pkg/config/output_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ func TestOutput_Validate(t *testing.T) {
4242
}
4343

4444
for _, test := range testCases {
45-
test := test
4645
t.Run(test.desc, func(t *testing.T) {
4746
t.Parallel()
4847

@@ -95,7 +94,6 @@ func TestOutput_Validate_error(t *testing.T) {
9594
}
9695

9796
for _, test := range testCases {
98-
test := test
9997
t.Run(test.desc, func(t *testing.T) {
10098
t.Parallel()
10199

@@ -133,7 +131,6 @@ func TestOutputFormat_Validate(t *testing.T) {
133131
}
134132

135133
for _, test := range testCases {
136-
test := test
137134
t.Run(test.desc, func(t *testing.T) {
138135
t.Parallel()
139136

@@ -164,7 +161,6 @@ func TestOutputFormat_Validate_error(t *testing.T) {
164161
}
165162

166163
for _, test := range testCases {
167-
test := test
168164
t.Run(test.desc, func(t *testing.T) {
169165
t.Parallel()
170166

0 commit comments

Comments
 (0)