From 6489a777e525f1dcd3883a25c855150e6961c5ed Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 5 Nov 2024 09:59:29 +0100 Subject: [PATCH] e2e: remove redundant capturing of loop vars in tests (copyloopvar) go1.22 and up now produce a unique variable in loops, tehrefore no longer requiring to capture the variable manually; service/logs/parse_logs_test.go:50:3: The copy of the 'for' variable "tc" can be deleted (Go 1.22+) (copyloopvar) tc := tc ^ Signed-off-by: Sebastiaan van Stijn --- e2e/cli-plugins/flags_test.go | 1 - e2e/container/run_test.go | 1 - e2e/global/cli_test.go | 1 - 3 files changed, 3 deletions(-) diff --git a/e2e/cli-plugins/flags_test.go b/e2e/cli-plugins/flags_test.go index c4e5fbcbc4..7631bab0de 100644 --- a/e2e/cli-plugins/flags_test.go +++ b/e2e/cli-plugins/flags_test.go @@ -131,7 +131,6 @@ func TestUnknownGlobal(t *testing.T) { "separate-val": {"--unknown", "foo", "helloworld"}, "joined-val": {"--unknown=foo", "helloworld"}, } { - args := args t.Run(name, func(t *testing.T) { res := icmd.RunCmd(run(args...)) res.Assert(t, icmd.Expected{ diff --git a/e2e/container/run_test.go b/e2e/container/run_test.go index d4fea81769..c835f1caf2 100644 --- a/e2e/container/run_test.go +++ b/e2e/container/run_test.go @@ -214,7 +214,6 @@ func TestMountSubvolume(t *testing.T) { {name: "subdirectory mount", cmd: "ls", subpath: "subdir", expectedOut: "hello.txt"}, {name: "file mount", cmd: "cat", subpath: "bar.txt", expectedOut: "foo"}, } { - tc := tc t.Run(tc.name, func(t *testing.T) { runMount(tc.cmd, "volume-subpath="+tc.subpath).Assert(t, icmd.Expected{ Err: tc.expectedErr, diff --git a/e2e/global/cli_test.go b/e2e/global/cli_test.go index 21b964d40b..86e67555a2 100644 --- a/e2e/global/cli_test.go +++ b/e2e/global/cli_test.go @@ -182,7 +182,6 @@ func TestPromptExitCode(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run("case="+tc.name, func(t *testing.T) { t.Parallel()