Skip to content

Commit 20d426f

Browse files
committed
all: remove unneeded loop variables in tests
Fixes #76411
1 parent 3c26aef commit 20d426f

File tree

28 files changed

+0
-35
lines changed

28 files changed

+0
-35
lines changed

src/cmd/api/api_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ var warmupCache = sync.OnceFunc(func() {
232232
// Warm up the import cache in parallel.
233233
var wg sync.WaitGroup
234234
for _, context := range contexts {
235-
context := context
236235
wg.Add(1)
237236
go func() {
238237
defer wg.Done()

src/cmd/cgo/internal/testerrors/errors_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ func TestToleratesOptimizationFlag(t *testing.T) {
152152
"",
153153
"-O",
154154
} {
155-
cflags := cflags
156155
t.Run(cflags, func(t *testing.T) {
157156
testenv.MustHaveGoBuild(t)
158157
testenv.MustHaveCGO(t)

src/cmd/cgo/internal/testsanitizers/asan_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ func TestASAN(t *testing.T) {
4848
{src: "arena_fail.go", memoryAccessError: "use-after-poison", errorLocation: "arena_fail.go:26", experiments: []string{"arenas"}},
4949
}
5050
for _, tc := range cases {
51-
tc := tc
5251
name := strings.TrimSuffix(tc.src, ".go")
5352
t.Run(name, func(t *testing.T) {
5453
t.Parallel()

src/cmd/cgo/internal/testsanitizers/cshared_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ func TestShared(t *testing.T) {
5454
}
5555

5656
for _, tc := range cases {
57-
tc := tc
5857
name := strings.TrimSuffix(tc.src, ".go")
5958
//The memory sanitizer tests require support for the -msan option.
6059
if tc.sanitizer == "memory" && !platform.MSanSupported(GOOS, GOARCH) {

src/cmd/cgo/internal/testsanitizers/libfuzzer_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ func TestLibFuzzer(t *testing.T) {
4343
{goSrc: "libfuzzer2.go", cSrc: "libfuzzer2.c", expectedError: "panic: found it"},
4444
}
4545
for _, tc := range cases {
46-
tc := tc
4746
name := strings.TrimSuffix(tc.goSrc, ".go")
4847
t.Run(name, func(t *testing.T) {
4948
t.Parallel()

src/cmd/cgo/internal/testsanitizers/msan_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ func TestMSAN(t *testing.T) {
6262
{src: "arena_fail.go", wantErr: true, experiments: []string{"arenas"}},
6363
}
6464
for _, tc := range cases {
65-
tc := tc
6665
name := strings.TrimSuffix(tc.src, ".go")
6766
t.Run(name, func(t *testing.T) {
6867
t.Parallel()

src/cmd/cgo/internal/testsanitizers/tsan_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ func TestTSAN(t *testing.T) {
5959
{src: "tsan_tracebackctxt", needsRuntime: true}, // Subdirectory
6060
}
6161
for _, tc := range cases {
62-
tc := tc
6362
name := strings.TrimSuffix(tc.src, ".go")
6463
t.Run(name, func(t *testing.T) {
6564
t.Parallel()

src/cmd/cgo/internal/teststdio/stdio_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ func TestTestRun(t *testing.T) {
5656
"fib.go",
5757
"hello.go",
5858
} {
59-
file := file
6059
wantFile := strings.Replace(file, ".go", ".out", 1)
6160
t.Run(file, func(t *testing.T) {
6261
cmd := exec.Command(testenv.GoToolPath(t), "run", file)

src/cmd/compile/internal/test/reproduciblebuilds_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ func TestReproducibleBuilds(t *testing.T) {
2626
}
2727
t.Parallel()
2828
for _, test := range tests {
29-
test := test
3029
t.Run(test, func(t *testing.T) {
3130
t.Parallel()
3231
var want []byte

src/cmd/compile/internal/test/ssa_test.go

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

164164
// Now we have a test binary. Run it with all the tests as subtests of this one.
165165
for _, test := range tests {
166-
test := test
167166
if flag == ",softfloat" && !test.usesFloat {
168167
// No point in running the soft float version if the test doesn't use floats.
169168
continue

0 commit comments

Comments
 (0)