aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2025-02-14 19:01:57 +0100
committerTaras Madan <tarasmadan@google.com>2025-02-17 08:18:57 +0000
commit4121cf9df313ee111c01fde1f255d010c8d941cd (patch)
treedcd0d104c8c35997103297dfb7dc1f0de6b77b8e /pkg
parent9f05da3db0234203729d2ad179ab5a2f72bf607f (diff)
all: remove loop variables scoping
Diffstat (limited to 'pkg')
-rw-r--r--pkg/bisect/bisect_test.go4
-rw-r--r--pkg/bisect/minimize/slice_test.go1
-rw-r--r--pkg/build/build_test.go2
-rw-r--r--pkg/compiler/compiler_test.go3
-rw-r--r--pkg/cover/backend/dwarf.go2
-rw-r--r--pkg/cover/report_test.go1
-rw-r--r--pkg/csource/csource_test.go2
-rw-r--r--pkg/email/lore/parse_test.go1
-rw-r--r--pkg/fuzzer/job.go1
-rw-r--r--pkg/report/linux_test.go1
-rw-r--r--pkg/runtest/run.go3
-rw-r--r--pkg/runtest/run_test.go1
-rw-r--r--pkg/stat/set_test.go1
-rw-r--r--pkg/vcs/linux_configs_test.go1
-rw-r--r--pkg/vminfo/features.go1
-rw-r--r--pkg/vminfo/vminfo_test.go1
16 files changed, 0 insertions, 26 deletions
diff --git a/pkg/bisect/bisect_test.go b/pkg/bisect/bisect_test.go
index 7d251c9e7..d09e6804e 100644
--- a/pkg/bisect/bisect_test.go
+++ b/pkg/bisect/bisect_test.go
@@ -732,7 +732,6 @@ func TestBisectionResults(t *testing.T) {
repoCache := make(chan string, len(bisectionTests))
t.Run("group", func(tt *testing.T) {
for _, test := range bisectionTests {
- test := test
tt.Run(test.name, func(t *testing.T) {
t.Parallel()
checkTest(t, test)
@@ -889,7 +888,6 @@ func TestBisectVerdict(t *testing.T) {
}
for _, test := range tests {
- test := test
t.Run(test.name, func(t *testing.T) {
sum := test.good + test.bad + test.infra + test.skip
assert.Equal(t, test.total, sum)
@@ -1008,7 +1006,6 @@ func TestMostFrequentReport(t *testing.T) {
},
}
for _, test := range tests {
- test := test
t.Run(test.name, func(t *testing.T) {
rep, types, other := mostFrequentReports(test.reports)
assert.ElementsMatch(t, types, test.types)
@@ -1066,7 +1063,6 @@ func TestPickReleaseTags(t *testing.T) {
},
}
for _, test := range tests {
- test := test
t.Run(test.name, func(t *testing.T) {
ret := pickReleaseTags(append([]string{}, test.tags...))
assert.Equal(t, test.ret, ret)
diff --git a/pkg/bisect/minimize/slice_test.go b/pkg/bisect/minimize/slice_test.go
index cd6ec37c6..3a5e5e178 100644
--- a/pkg/bisect/minimize/slice_test.go
+++ b/pkg/bisect/minimize/slice_test.go
@@ -112,7 +112,6 @@ func TestBisectRandomSlice(t *testing.T) {
func BenchmarkSplits(b *testing.B) {
for _, guilty := range []int{1, 2, 3, 4} {
- guilty := guilty
b.Run(fmt.Sprintf("%d_guilty", guilty), func(b *testing.B) {
var sum int
for i := 0; i < b.N; i++ {
diff --git a/pkg/build/build_test.go b/pkg/build/build_test.go
index 6aa9d9216..7491a113c 100644
--- a/pkg/build/build_test.go
+++ b/pkg/build/build_test.go
@@ -17,7 +17,6 @@ import (
func TestCompilerIdentity(t *testing.T) {
t.Parallel()
for _, compiler := range []string{"gcc", "clang", "bazel"} {
- compiler := compiler
t.Run(compiler, func(t *testing.T) {
t.Parallel()
if _, err := exec.LookPath(compiler); err != nil {
@@ -42,7 +41,6 @@ func TestCompilerIdentity(t *testing.T) {
func TestExtractCauseInner(t *testing.T) {
for i, test := range rootCauseTests {
- test := test
t.Run(fmt.Sprint(i), func(t *testing.T) {
reason, file := extractCauseInner([]byte(test.e), test.src)
if test.reason != string(reason) {
diff --git a/pkg/compiler/compiler_test.go b/pkg/compiler/compiler_test.go
index 711567163..cd82b4650 100644
--- a/pkg/compiler/compiler_test.go
+++ b/pkg/compiler/compiler_test.go
@@ -23,7 +23,6 @@ var flagUpdate = flag.Bool("update", false, "reformat all.txt")
func TestCompileAll(t *testing.T) {
for os, arches := range targets.List {
- os, arches := os, arches
t.Run(os, func(t *testing.T) {
t.Parallel()
eh := func(pos ast.Pos, msg string) {
@@ -35,7 +34,6 @@ func TestCompileAll(t *testing.T) {
t.Fatalf("parsing failed")
}
for arch, target := range arches {
- arch, target := arch, target
t.Run(arch, func(t *testing.T) {
t.Parallel()
errors := new(bytes.Buffer)
@@ -68,7 +66,6 @@ func TestData(t *testing.T) {
// Because of this we have one file per phase.
for _, name := range []string{"errors.txt", "errors2.txt", "errors3.txt", "warnings.txt", "all.txt"} {
for _, arch := range []string{targets.TestArch32, targets.TestArch64} {
- name, arch := name, arch
t.Run(fmt.Sprintf("%v/%v", name, arch), func(t *testing.T) {
t.Parallel()
target := targets.List[targets.TestOS][arch]
diff --git a/pkg/cover/backend/dwarf.go b/pkg/cover/backend/dwarf.go
index eeb924a4b..a4cfd536f 100644
--- a/pkg/cover/backend/dwarf.go
+++ b/pkg/cover/backend/dwarf.go
@@ -161,8 +161,6 @@ func makeDWARFUnsafe(params *dwarfParams) (*Impl, error) {
}
binC := make(chan binResult, len(modules))
for _, module := range modules {
- // check https://go.dev/blog/loopvar-preview for loopvar bug
- module := module
go func() {
info := &symbolInfo{
tracePC: make(map[uint64]bool),
diff --git a/pkg/cover/report_test.go b/pkg/cover/report_test.go
index c021856cd..40fcb7034 100644
--- a/pkg/cover/report_test.go
+++ b/pkg/cover/report_test.go
@@ -148,7 +148,6 @@ func TestReportGenerator(t *testing.T) {
t.Skip("skipping the test due to broken cross-compiler:\n" + target.BrokenCompiler)
}
for _, test := range tests {
- test := test
t.Run(test.Name, func(t *testing.T) {
if test.Supports != nil && !test.Supports(target) {
t.Skip("unsupported target")
diff --git a/pkg/csource/csource_test.go b/pkg/csource/csource_test.go
index c97757d01..472e82225 100644
--- a/pkg/csource/csource_test.go
+++ b/pkg/csource/csource_test.go
@@ -38,7 +38,6 @@ func TestGenerate(t *testing.T) {
t.Parallel()
checked := make(map[string]bool)
for _, target := range prog.AllTargets() {
- target := target
sysTarget := targets.Get(target.OS, target.Arch)
if runtime.GOOS != sysTarget.BuildOS {
continue
@@ -114,7 +113,6 @@ func testTarget(t *testing.T, target *prog.Target, full bool) {
// compilation time from 1.94s to 104.73s and memory consumption from 136MB to 8116MB.
continue
}
- opts := opts
t.Run(fmt.Sprintf("%v", opti), func(t *testing.T) {
t.Parallel()
testOne(t, p, opts)
diff --git a/pkg/email/lore/parse_test.go b/pkg/email/lore/parse_test.go
index 125b572c5..3ee9ec392 100644
--- a/pkg/email/lore/parse_test.go
+++ b/pkg/email/lore/parse_test.go
@@ -301,7 +301,6 @@ func TestParsePatchSubject(t *testing.T) {
},
}
for id, test := range tests {
- test := test
t.Run(fmt.Sprint(id), func(t *testing.T) {
ret, ok := parsePatchSubject(test.subj)
assert.True(t, ok)
diff --git a/pkg/fuzzer/job.go b/pkg/fuzzer/job.go
index 8786d046d..7b06bc97f 100644
--- a/pkg/fuzzer/job.go
+++ b/pkg/fuzzer/job.go
@@ -152,7 +152,6 @@ func (job *triageJob) run(fuzzer *Fuzzer) {
}
var wg sync.WaitGroup
for call, info := range job.calls {
- call, info := call, info
wg.Add(1)
go func() {
job.handleCall(call, info)
diff --git a/pkg/report/linux_test.go b/pkg/report/linux_test.go
index bb19ed6bf..7e5c028ef 100644
--- a/pkg/report/linux_test.go
+++ b/pkg/report/linux_test.go
@@ -430,7 +430,6 @@ func TestParseLinuxOpcodes(t *testing.T) {
}
for idx, test := range tests {
- test := test // Capturing the value.
t.Run(fmt.Sprintf("%s/%v", test.arch, idx), func(t *testing.T) {
t.Parallel()
_, linuxReporter := prepareLinuxReporter(t, test.arch)
diff --git a/pkg/runtest/run.go b/pkg/runtest/run.go
index d9f0aa25a..e95a1aa38 100644
--- a/pkg/runtest/run.go
+++ b/pkg/runtest/run.go
@@ -241,7 +241,6 @@ nextSandbox:
"arch=" + ctx.Target.Arch: true,
}
for _, threaded := range []bool{false, true} {
- name := name
if threaded {
name += "/thr"
}
@@ -259,7 +258,6 @@ nextSandbox:
if times != 1 {
break
}
- name := name
if cov {
name += "/cover"
}
@@ -277,7 +275,6 @@ nextSandbox:
// and copy the binary to the target system.
continue
}
- name := name
properties["C"] = true
properties["executor"] = false
name += " C"
diff --git a/pkg/runtest/run_test.go b/pkg/runtest/run_test.go
index f11d2d231..09a401bb7 100644
--- a/pkg/runtest/run_test.go
+++ b/pkg/runtest/run_test.go
@@ -370,7 +370,6 @@ func testCover(t *testing.T, target *prog.Target) {
}
executor := csource.BuildExecutor(t, target, "../../")
for i, test := range tests {
- test := test
t.Run(fmt.Sprint(i), func(t *testing.T) {
t.Parallel()
source := queue.Plain()
diff --git a/pkg/stat/set_test.go b/pkg/stat/set_test.go
index 4f087b7ff..da18ceb2d 100644
--- a/pkg/stat/set_test.go
+++ b/pkg/stat/set_test.go
@@ -190,7 +190,6 @@ func TestSetStress(t *testing.T) {
}
for p := 0; p < 2; p++ {
for _, opt := range []any{Link(""), NoGraph, Rate{}, Distribution{}} {
- opt := opt
go func() {
v := set.New(fmt.Sprintf("v%v", seq.Add(1)), "desc", opt)
for p1 := 0; p1 < 2; p1++ {
diff --git a/pkg/vcs/linux_configs_test.go b/pkg/vcs/linux_configs_test.go
index 80be75db7..93449ca8b 100644
--- a/pkg/vcs/linux_configs_test.go
+++ b/pkg/vcs/linux_configs_test.go
@@ -71,7 +71,6 @@ CONFIG_DEBUG_ATOMIC_SLEEP=y
CONFIG_PROVE_LOCKING=y
`
for _, test := range tests {
- test := test
t.Run(test.name, func(t *testing.T) {
conf, err := kconfig.ParseConfigData([]byte(base), "base")
if err != nil {
diff --git a/pkg/vminfo/features.go b/pkg/vminfo/features.go
index bf2d152ab..2be067d32 100644
--- a/pkg/vminfo/features.go
+++ b/pkg/vminfo/features.go
@@ -48,7 +48,6 @@ type featureResult struct {
func (ctx *checkContext) startFeaturesCheck() {
testProg := ctx.target.DataMmapProg()
for feat := range flatrpc.EnumNamesFeature {
- feat := feat
if ctx.cfg.Features&feat == 0 {
ctx.features <- featureResult{feat, "disabled by user"}
continue
diff --git a/pkg/vminfo/vminfo_test.go b/pkg/vminfo/vminfo_test.go
index 7a50d5142..c54b43e21 100644
--- a/pkg/vminfo/vminfo_test.go
+++ b/pkg/vminfo/vminfo_test.go
@@ -49,7 +49,6 @@ func TestSyscalls(t *testing.T) {
t.Parallel()
for _, arches := range targets.List {
for _, target := range arches {
- target := target
if target.OS == targets.Linux {
continue // linux has own TestLinuxSyscalls test
}