Skip to content

Commit 66dbcbd

Browse files
committed
Remove copied loop vars.
1 parent 4ffcadb commit 66dbcbd

File tree

4 files changed

+1
-12
lines changed

4 files changed

+1
-12
lines changed

.golangci.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ linters:
77
enable:
88
- asciicheck
99
- bodyclose
10+
- copyloopvar
1011
- cyclop
1112
- dogsled
1213
- durationcheck
@@ -15,8 +16,6 @@ linters:
1516
- errname
1617
- errorlint
1718
- exhaustive
18-
- exportloopref
19-
- exportloopref
2019
- gochecknoinits
2120
- gocognit
2221
- goconst

checks_test.go

-7
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ func TestCheckPeriod(t *testing.T) {
234234
}
235235

236236
for _, tt := range testCases {
237-
tt := tt
238237
t.Run(tt.name, func(t *testing.T) {
239238
issue := checkPeriod(tt.comment)
240239
switch {
@@ -371,7 +370,6 @@ func TestCheckCapital(t *testing.T) {
371370
}
372371

373372
for _, tt := range testCases {
374-
tt := tt
375373
t.Run(tt.name, func(t *testing.T) {
376374
issues := checkCapital(tt.comment)
377375
if len(issues) != len(tt.issues) {
@@ -443,7 +441,6 @@ func TestIsSpecialBlock(t *testing.T) {
443441
}
444442

445443
for _, tt := range testCases {
446-
tt := tt
447444
t.Run(tt.name, func(t *testing.T) {
448445
if isSpecialBlock(tt.comment) != tt.isSpecial {
449446
t.Fatalf("Wrong result")
@@ -536,7 +533,6 @@ func TestIsSpecialLine(t *testing.T) {
536533
}
537534

538535
for _, tt := range testCases {
539-
tt := tt
540536
t.Run(tt.name, func(t *testing.T) {
541537
if isSpecialLine(tt.comment) != tt.isSpecial {
542538
t.Fatalf("Wrong result")
@@ -579,7 +575,6 @@ func TestHasSuffix(t *testing.T) {
579575
}
580576

581577
for _, tt := range testCases {
582-
tt := tt
583578
t.Run(tt.name, func(t *testing.T) {
584579
if hasSuffix(tt.text, tt.suffixes) != tt.result {
585580
t.Fatalf("Wrong result")
@@ -616,7 +611,6 @@ func TestByteToRuneColumn(t *testing.T) {
616611
}
617612

618613
for _, tt := range testCases {
619-
tt := tt
620614
t.Run(tt.name, func(t *testing.T) {
621615
if out := byteToRuneColumn(tt.str, tt.index); out != tt.out {
622616
t.Fatalf("Wrong column\n expected: %d\n got: %d", tt.out, out)
@@ -653,7 +647,6 @@ func TestRuneToByteColumn(t *testing.T) {
653647
}
654648

655649
for _, tt := range testCases {
656-
tt := tt
657650
t.Run(tt.name, func(t *testing.T) {
658651
if out := runeToByteColumn(tt.str, tt.index); out != tt.out {
659652
t.Fatalf("Wrong column\n expected: %d\n got: %d", tt.out, out)

getters_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ func TestGetComments(t *testing.T) {
5151
}
5252

5353
for _, tt := range testCases {
54-
tt := tt
5554
t.Run(tt.name, func(t *testing.T) {
5655
comments := pf.getComments(tt.scope, nil)
5756
var expected int
@@ -226,7 +225,6 @@ func TestGetText(t *testing.T) {
226225
}
227226

228227
for _, tt := range testCases {
229-
tt := tt
230228
t.Run(tt.name, func(t *testing.T) {
231229
var re []*regexp.Regexp
232230
if tt.exclude != nil {

godot_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ func TestRun(t *testing.T) {
117117
}
118118

119119
for _, tt := range testCases {
120-
tt := tt
121120
t.Run(tt.name, func(t *testing.T) {
122121
var expected int
123122
for _, c := range file.Comments {

0 commit comments

Comments
 (0)