Skip to content

Commit 2b4b2dc

Browse files
committed
all: remove loop variables scoping
1 parent f895ae6 commit 2b4b2dc

File tree

33 files changed

+0
-46
lines changed

33 files changed

+0
-46
lines changed

dashboard/app/access_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,6 @@ func TestAccess(t *testing.T) {
421421
// In the short mode, only test that there's no public access to non-public URLs.
422422
continue
423423
}
424-
ent := ent
425424
t.Run(fmt.Sprintf("level%d_%d", requestLevel, i), func(t *testing.T) {
426425
reply := checkPage(t, requestLevel, ent.level, ent.url)
427426
checkReferences(t, ent.url, requestLevel, reply)

dashboard/app/email_test.go

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

474474
func TestEmailDup2(t *testing.T) {
475475
for i := 0; i < 4; i++ {
476-
i := i
477476
t.Run(fmt.Sprint(i), func(t *testing.T) {
478477
c := NewCtx(t)
479478
defer c.Close()

dashboard/app/jobs.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,7 +1855,6 @@ func (j *bugJob) loadBuild(c context.Context) error {
18551855
func fullBackportInfo(c context.Context, list []*backportInfo) error {
18561856
crashLoader := &dependencyLoader[Crash]{}
18571857
for _, info := range list {
1858-
info := info
18591858
if info.job.CrashID == 0 {
18601859
continue
18611860
}
@@ -1869,7 +1868,6 @@ func fullBackportInfo(c context.Context, list []*backportInfo) error {
18691868
}
18701869
buildLoader := &dependencyLoader[Build]{}
18711870
for _, info := range list {
1872-
info := info
18731871
if info.crash == nil {
18741872
continue
18751873
}

dashboard/app/reporting_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,6 @@ func TestObsoletePeriod(t *testing.T) {
12131213
}
12141214

12151215
for _, test := range tests {
1216-
test := test
12171216
t.Run(test.name, func(t *testing.T) {
12181217
ret := test.bug.obsoletePeriod(c)
12191218
assert.Equal(t, test.period, ret)

dashboard/app/stats.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ func allBugInputs(c context.Context, ns string) ([]*bugInput, error) {
8484
}
8585
buildLoader := &dependencyLoader[Build]{}
8686
for _, input := range inputs {
87-
input := input
8887
if input.reportedCrash == nil {
8988
continue
9089
}

pkg/bisect/bisect_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,6 @@ func TestBisectionResults(t *testing.T) {
732732
repoCache := make(chan string, len(bisectionTests))
733733
t.Run("group", func(tt *testing.T) {
734734
for _, test := range bisectionTests {
735-
test := test
736735
tt.Run(test.name, func(t *testing.T) {
737736
t.Parallel()
738737
checkTest(t, test)
@@ -889,7 +888,6 @@ func TestBisectVerdict(t *testing.T) {
889888
}
890889

891890
for _, test := range tests {
892-
test := test
893891
t.Run(test.name, func(t *testing.T) {
894892
sum := test.good + test.bad + test.infra + test.skip
895893
assert.Equal(t, test.total, sum)
@@ -1008,7 +1006,6 @@ func TestMostFrequentReport(t *testing.T) {
10081006
},
10091007
}
10101008
for _, test := range tests {
1011-
test := test
10121009
t.Run(test.name, func(t *testing.T) {
10131010
rep, types, other := mostFrequentReports(test.reports)
10141011
assert.ElementsMatch(t, types, test.types)
@@ -1066,7 +1063,6 @@ func TestPickReleaseTags(t *testing.T) {
10661063
},
10671064
}
10681065
for _, test := range tests {
1069-
test := test
10701066
t.Run(test.name, func(t *testing.T) {
10711067
ret := pickReleaseTags(append([]string{}, test.tags...))
10721068
assert.Equal(t, test.ret, ret)

pkg/bisect/minimize/slice_test.go

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

113113
func BenchmarkSplits(b *testing.B) {
114114
for _, guilty := range []int{1, 2, 3, 4} {
115-
guilty := guilty
116115
b.Run(fmt.Sprintf("%d_guilty", guilty), func(b *testing.B) {
117116
var sum int
118117
for i := 0; i < b.N; i++ {

pkg/build/build_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
func TestCompilerIdentity(t *testing.T) {
1818
t.Parallel()
1919
for _, compiler := range []string{"gcc", "clang", "bazel"} {
20-
compiler := compiler
2120
t.Run(compiler, func(t *testing.T) {
2221
t.Parallel()
2322
if _, err := exec.LookPath(compiler); err != nil {
@@ -42,7 +41,6 @@ func TestCompilerIdentity(t *testing.T) {
4241

4342
func TestExtractCauseInner(t *testing.T) {
4443
for i, test := range rootCauseTests {
45-
test := test
4644
t.Run(fmt.Sprint(i), func(t *testing.T) {
4745
reason, file := extractCauseInner([]byte(test.e), test.src)
4846
if test.reason != string(reason) {

pkg/compiler/compiler_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ var flagUpdate = flag.Bool("update", false, "reformat all.txt")
2323

2424
func TestCompileAll(t *testing.T) {
2525
for os, arches := range targets.List {
26-
os, arches := os, arches
2726
t.Run(os, func(t *testing.T) {
2827
t.Parallel()
2928
eh := func(pos ast.Pos, msg string) {
@@ -35,7 +34,6 @@ func TestCompileAll(t *testing.T) {
3534
t.Fatalf("parsing failed")
3635
}
3736
for arch, target := range arches {
38-
arch, target := arch, target
3937
t.Run(arch, func(t *testing.T) {
4038
t.Parallel()
4139
errors := new(bytes.Buffer)
@@ -68,7 +66,6 @@ func TestData(t *testing.T) {
6866
// Because of this we have one file per phase.
6967
for _, name := range []string{"errors.txt", "errors2.txt", "errors3.txt", "warnings.txt", "all.txt"} {
7068
for _, arch := range []string{targets.TestArch32, targets.TestArch64} {
71-
name, arch := name, arch
7269
t.Run(fmt.Sprintf("%v/%v", name, arch), func(t *testing.T) {
7370
t.Parallel()
7471
target := targets.List[targets.TestOS][arch]

pkg/cover/backend/dwarf.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,6 @@ func makeDWARFUnsafe(params *dwarfParams) (*Impl, error) {
161161
}
162162
binC := make(chan binResult, len(modules))
163163
for _, module := range modules {
164-
// check https://go.dev/blog/loopvar-preview for loopvar bug
165-
module := module
166164
go func() {
167165
info := &symbolInfo{
168166
tracePC: make(map[uint64]bool),

0 commit comments

Comments
 (0)