From b5aefe07e5afe2fd5d49c6a4219cc826b3e4e34e Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Tue, 14 Oct 2025 11:40:26 +0200 Subject: 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 Auto-Submit: Damien Neil Reviewed-by: Dmitri Shuralyov Reviewed-by: Damien Neil Auto-Submit: Tobias Klauser LUCI-TryBot-Result: Go LUCI --- src/os/exec/exec_posix_test.go | 2 -- src/os/signal/signal_test.go | 4 ---- 2 files changed, 6 deletions(-) (limited to 'src/os') diff --git a/src/os/exec/exec_posix_test.go b/src/os/exec/exec_posix_test.go index 77c5fc11e4..0711fac90e 100644 --- a/src/os/exec/exec_posix_test.go +++ b/src/os/exec/exec_posix_test.go @@ -165,7 +165,6 @@ func TestImplicitPWD(t *testing.T) { } for _, tc := range cases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() @@ -242,7 +241,6 @@ func TestExplicitPWD(t *testing.T) { // contain symlinks preserved from the PWD value in the test's environment. } for _, tc := range cases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/src/os/signal/signal_test.go b/src/os/signal/signal_test.go index 0aa0439b90..8d3f230178 100644 --- a/src/os/signal/signal_test.go +++ b/src/os/signal/signal_test.go @@ -347,7 +347,6 @@ func TestStop(t *testing.T) { } for _, sig := range sigs { - sig := sig t.Run(fmt.Sprint(sig), func(t *testing.T) { // When calling Notify with a specific signal, // independent signals should not interfere with each other, @@ -441,7 +440,6 @@ func TestNohup(t *testing.T) { subTimeout -= subTimeout / 10 // Leave 10% headroom for propagating output. } for i := 1; i <= 2; i++ { - i := i t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { t.Parallel() @@ -484,7 +482,6 @@ func TestNohup(t *testing.T) { subTimeout -= subTimeout / 10 // Leave 10% headroom for propagating output. } for i := 1; i <= 2; i++ { - i := i t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { t.Parallel() @@ -743,7 +740,6 @@ func TestNotifyContextNotifications(t *testing.T) { {"multiple", 10}, } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() -- cgit v1.3-5-g9baa