Skip to content

Commit

Permalink
style: replaced deprecated linter exportloopref with copyloopvar (#795)
Browse files Browse the repository at this point in the history
Updated golangci-lint configuration and resolved all linting issues
identified by the updated settings.
  • Loading branch information
lukasmetzner committed Nov 19, 2024
1 parent e9de564 commit 66eed46
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 16 deletions.
2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ linters:
disable-all: true
enable:
- bodyclose
- copyloopvar
- errcheck
- errname
- exhaustive
- exportloopref
- gci
- gocritic
- godot
Expand Down
1 change: 0 additions & 1 deletion hcloud/load_balancers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,6 @@ func TestLoadBalancer_matchNodeSelector(t *testing.T) {
}

for _, c := range cases {
c := c // prevent scopelint from complaining
t.Run(c.name, func(t *testing.T) {
nodes, err := matchNodeSelector(c.service, c.k8sNodes)
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion internal/annotation/load_balancer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ func TestLBToService_AddAnnotations(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
err := annotation.LBToService(&tt.svc, &tt.lb)
assert.NoError(t, err)
Expand Down
3 changes: 0 additions & 3 deletions internal/annotation/name_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ func TestName_AddToService(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
err := ann.AnnotateService(&tt.svc, tt.value)
if tt.err != nil {
Expand Down Expand Up @@ -123,7 +122,6 @@ func TestName_StringFromService(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
var svc corev1.Service

Expand Down Expand Up @@ -478,7 +476,6 @@ func runAllTypedAccessorTests(
t.Helper()

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
tt.run(t, call)
})
Expand Down
1 change: 0 additions & 1 deletion internal/hcops/certificates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ func (tt *certificateOpsTestCase) run(t *testing.T) {

func runCertificateOpsTestCases(t *testing.T, tests []certificateOpsTestCase) {
for _, tt := range tests {
tt := tt
t.Run(tt.Name, tt.run)
}
}
1 change: 0 additions & 1 deletion internal/hcops/load_balancer_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ func TestHCLBServiceOptsBuilder(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
tt.certClient = &mocks.CertificateClient{}
tt.certClient.Test(t)
Expand Down
8 changes: 0 additions & 8 deletions internal/hcops/load_balancer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ func TestLoadBalancerOps_GetByName(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
fx := hcops.NewLoadBalancerOpsFixture(t)
if tt.mock != nil {
Expand Down Expand Up @@ -146,7 +145,6 @@ func TestLoadBalancerOps_GetByID(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
fx := hcops.NewLoadBalancerOpsFixture(t)
if tt.mock != nil {
Expand Down Expand Up @@ -201,7 +199,6 @@ func TestGetByK8SServiceUID(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
fx := hcops.NewLoadBalancerOpsFixture(t)

Expand Down Expand Up @@ -463,7 +460,6 @@ func TestLoadBalancerOps_Create(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
fx := hcops.NewLoadBalancerOpsFixture(t)

Expand Down Expand Up @@ -525,7 +521,6 @@ func TestLoadBalancerOps_Delete(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
fx := hcops.NewLoadBalancerOpsFixture(t)
ctx := context.Background()
Expand Down Expand Up @@ -1137,7 +1132,6 @@ func TestLoadBalancerOps_ReconcileHCLB(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, tt.run)
}
}
Expand Down Expand Up @@ -1421,7 +1415,6 @@ func TestLoadBalancerOps_ReconcileHCLBTargets(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, tt.run)
}
}
Expand Down Expand Up @@ -1700,7 +1693,6 @@ func TestLoadBalancerOps_ReconcileHCLBServices(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, tt.run)
}
}

0 comments on commit 66eed46

Please sign in to comment.