diff --git a/common/config/.golangci.yml b/common/config/.golangci.yml index 2c0565492..b5a0349b9 100644 --- a/common/config/.golangci.yml +++ b/common/config/.golangci.yml @@ -18,7 +18,7 @@ linters: disable-all: true enable: - errcheck - - exportloopref + - copyloopvar - depguard - gocritic - gofumpt diff --git a/controllers/istio/istio_controller_test.go b/controllers/istio/istio_controller_test.go index f91a9db54..129acf0ea 100644 --- a/controllers/istio/istio_controller_test.go +++ b/controllers/istio/istio_controller_test.go @@ -527,7 +527,6 @@ func TestDetermineStatus(t *testing.T) { initObjs := []client.Object{istio} for _, rev := range tc.revisions { - rev := rev initObjs = append(initObjs, &rev) } @@ -728,7 +727,6 @@ func TestUpdateStatus(t *testing.T) { initObjs := []client.Object{istio} for _, rev := range tc.revisions { - rev := rev initObjs = append(initObjs, &rev) } diff --git a/tests/e2e/controlplane/control_plane_test.go b/tests/e2e/controlplane/control_plane_test.go index e55967f80..c3e9dcc1e 100644 --- a/tests/e2e/controlplane/control_plane_test.go +++ b/tests/e2e/controlplane/control_plane_test.go @@ -117,9 +117,6 @@ metadata: Describe("given Istio version", func() { for _, version := range supportedversion.List { - // Note: This var version is needed to avoid the closure of the loop - version := version - Context(version.Name, func() { BeforeAll(func() { Expect(k.CreateNamespace(controlPlaneNamespace)).To(Succeed(), "Istio namespace failed to be created") diff --git a/tests/e2e/dualstack/dualstack_test.go b/tests/e2e/dualstack/dualstack_test.go index 9a7768438..15ccb350d 100644 --- a/tests/e2e/dualstack/dualstack_test.go +++ b/tests/e2e/dualstack/dualstack_test.go @@ -70,9 +70,6 @@ var _ = Describe("DualStack configuration ", Ordered, func() { Describe("for supported versions", func() { for _, version := range supportedversion.List { - // Note: This var version is needed to avoid the closure of the loop - version := version - // The minimum supported version is 1.23 (and above) if version.Version.LessThan(semver.MustParse("1.23.0")) { continue diff --git a/tests/integration/api/istio_test.go b/tests/integration/api/istio_test.go index ce7254443..20084d952 100644 --- a/tests/integration/api/istio_test.go +++ b/tests/integration/api/istio_test.go @@ -222,8 +222,6 @@ var _ = Describe("Istio resource", Ordered, func() { }) for _, withWorkloads := range []bool{true, false} { - withWorkloads := withWorkloads - Context(generateContextName(withWorkloads), func() { if withWorkloads { BeforeAll(func() {