diff options
| author | Tobias Klauser <tklauser@distanz.ch> | 2025-10-14 11:40:26 +0200 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-10-17 13:10:27 -0700 |
| commit | b5aefe07e5afe2fd5d49c6a4219cc826b3e4e34e (patch) | |
| tree | 3b3576e22ccc48d21f106c65d3bd10f368aaabf6 /src/testing | |
| parent | 5137c473b64cb157380eb6deb1b60bf6780402b3 (diff) | |
| download | go-b5aefe07e5afe2fd5d49c6a4219cc826b3e4e34e.tar.xz | |
all: remove unnecessary loop variable copies in tests
Copying the loop variable is no longer necessary since Go 1.22.
Change-Id: Iebb21dac44a20ec200567f1d786f105a4ee4999d
Reviewed-on: https://go-review.googlesource.com/c/go/+/711640
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/testing')
| -rw-r--r-- | src/testing/flag_test.go | 1 | ||||
| -rw-r--r-- | src/testing/panic_test.go | 1 | ||||
| -rw-r--r-- | src/testing/sub_test.go | 1 |
3 files changed, 0 insertions, 3 deletions
diff --git a/src/testing/flag_test.go b/src/testing/flag_test.go index 6a7754425d..fb65e15928 100644 --- a/src/testing/flag_test.go +++ b/src/testing/flag_test.go @@ -25,7 +25,6 @@ func TestFlag(t *testing.T) { testenv.MustHaveExec(t) for _, flag := range []string{"", "-test.v", "-test.v=test2json"} { - flag := flag t.Run(flag, func(t *testing.T) { t.Parallel() cmd := exec.Command(testenv.Executable(t), "-test.run=^TestFlag$", "-test_flag_arg="+flag) diff --git a/src/testing/panic_test.go b/src/testing/panic_test.go index fc84175ee6..01a34b0801 100644 --- a/src/testing/panic_test.go +++ b/src/testing/panic_test.go @@ -198,7 +198,6 @@ func TestPanicHelper(t *testing.T) { } }) for i := 0; i < 3; i++ { - i := i t.Run(fmt.Sprintf("%v", i), func(t *testing.T) { chosen := t.Name() == *testPanicTest if chosen && *testPanicCleanup { diff --git a/src/testing/sub_test.go b/src/testing/sub_test.go index bb5586d9fc..5d5573ccec 100644 --- a/src/testing/sub_test.go +++ b/src/testing/sub_test.go @@ -988,7 +988,6 @@ func TestConcurrentCleanup(t *T) { var wg sync.WaitGroup wg.Add(2) for i := 0; i < 2; i++ { - i := i go func() { t.Cleanup(func() { // Although the calls to Cleanup are concurrent, the functions passed |
