Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant variable copying in for loops #473

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/config/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ linters:
disable-all: true
enable:
- errcheck
- exportloopref
- copyloopvar
- depguard
- gocritic
- gofumpt
Expand Down
2 changes: 0 additions & 2 deletions controllers/istio/istio_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,6 @@ func TestDetermineStatus(t *testing.T) {

initObjs := []client.Object{istio}
for _, rev := range tc.revisions {
rev := rev
initObjs = append(initObjs, &rev)
}

Expand Down Expand Up @@ -728,7 +727,6 @@ func TestUpdateStatus(t *testing.T) {

initObjs := []client.Object{istio}
for _, rev := range tc.revisions {
rev := rev
initObjs = append(initObjs, &rev)
}

Expand Down
3 changes: 0 additions & 3 deletions tests/e2e/controlplane/control_plane_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 0 additions & 3 deletions tests/e2e/dualstack/dualstack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/api/istio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down