Skip to content

Commit 764216a

Browse files
Fix linting for changes in Go >1.22:
No longer need to copy variables in for loops. Signed-off-by: Jacob Weinstock <[email protected]>
1 parent d773912 commit 764216a

File tree

4 files changed

+1
-7
lines changed

4 files changed

+1
-7
lines changed

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ linters:
1313
- errorlint
1414
- exhaustive
1515
# - exhaustivestruct
16-
- exportloopref
16+
- copyloopvar
1717
- forbidigo
1818
- forcetypeassert
1919
- funlen

controller/machine/hardware.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,6 @@ func byHardwareAffinity(hardware []tinkv1.Hardware, preferred []infrastructurev1
251251
scores := map[client.ObjectKey]int32{}
252252
// compute scores for each item based on the preferred term weights
253253
for _, term := range preferred {
254-
term := term
255-
256254
selector, err := metav1.LabelSelectorAsSelector(&term.HardwareAffinityTerm.LabelSelector)
257255
if err != nil {
258256
return nil, fmt.Errorf("constructing label selector: %w", err)

controller/machine/scope_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ func Test_Machine(t *testing.T) {
8484
}
8585

8686
for name, c := range cases {
87-
name, c := name, c
88-
8987
t.Run(name, func(t *testing.T) {
9088
t.Parallel()
9189
g := NewWithT(t)

controller/machine/template_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ func Test_Cloud_config_template(t *testing.T) {
7676
}
7777

7878
for name, c := range cases {
79-
c := c
80-
8179
t.Run(name, func(t *testing.T) {
8280
t.Parallel()
8381
g := NewWithT(t)

0 commit comments

Comments
 (0)