Skip to content

Commit 76ab740

Browse files
authored
Merge pull request kubernetes-sigs#9622 from adityabhatia/bump-golangci-lint-1.55.1
🌱 Bump golangci-lint to v1.55.1
2 parents b87365c + 59bf58d commit 76ab740

File tree

29 files changed

+80
-45
lines changed

29 files changed

+80
-45
lines changed

.github/workflows/pr-golangci-lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ jobs:
3030
- name: golangci-lint
3131
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # tag=v3.7.0
3232
with:
33-
version: v1.54.1
33+
version: v1.55.1
3434
args: --out-format=colored-line-number
3535
working-directory: ${{matrix.working-directory}}

.golangci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ linters-settings:
200200
#
201201
- name: bool-literal-in-expr
202202
- name: constant-logical-expr
203+
goconst:
204+
ignore-tests: true
203205
issues:
204206
max-same-issues: 0
205207
max-issues-per-linter: 0

cmd/clusterctl/client/move.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ func (c *clusterctlClient) Move(ctx context.Context, options MoveOptions) error
7070
return c.toDirectory(ctx, options)
7171
} else if options.FromDirectory != "" {
7272
return c.fromDirectory(ctx, options)
73-
} else {
74-
return c.move(ctx, options)
7573
}
74+
75+
return c.move(ctx, options)
7676
}
7777

7878
func (c *clusterctlClient) move(ctx context.Context, options MoveOptions) error {

controllers/remote/cluster_cache_tracker_test.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package remote
1818

1919
import (
2020
"context"
21+
"fmt"
2122
"testing"
2223

2324
"github.com/davecgh/go-spew/spew"
@@ -44,12 +45,16 @@ func mapper(_ context.Context, i client.Object) []reconcile.Request {
4445
{
4546
NamespacedName: types.NamespacedName{
4647
Namespace: i.GetNamespace(),
47-
Name: "mapped-" + i.GetName(),
48+
Name: getMappedName(i.GetName()),
4849
},
4950
},
5051
}
5152
}
5253

54+
func getMappedName(name string) string {
55+
return fmt.Sprintf("mapped-%s", name)
56+
}
57+
5358
func TestClusterCacheTracker(t *testing.T) {
5459
t.Run("watching", func(t *testing.T) {
5560
var (
@@ -127,7 +132,7 @@ func TestClusterCacheTracker(t *testing.T) {
127132
g.Expect(cleanupTestSecrets(ctx, k8sClient)).To(Succeed())
128133
t.Log("Deleting any Clusters")
129134
g.Expect(cleanupTestClusters(ctx, k8sClient)).To(Succeed())
130-
g.Expect(<-c.ch).To(Equal("mapped-" + clusterA.Name))
135+
g.Expect(<-c.ch).To(Equal(getMappedName(clusterA.Name)))
131136
g.Consistently(c.ch).ShouldNot(Receive())
132137
t.Log("Deleting Namespace")
133138
g.Expect(env.Delete(ctx, ns)).To(Succeed())
@@ -150,7 +155,7 @@ func TestClusterCacheTracker(t *testing.T) {
150155
})).To(Succeed())
151156

152157
t.Log("Waiting to receive the watch notification")
153-
g.Expect(<-c.ch).To(Equal("mapped-" + clusterA.Name))
158+
g.Expect(<-c.ch).To(Equal(getMappedName(clusterA.Name)))
154159

155160
t.Log("Ensuring no additional watch notifications arrive")
156161
g.Consistently(c.ch).ShouldNot(Receive())
@@ -162,7 +167,7 @@ func TestClusterCacheTracker(t *testing.T) {
162167
g.Expect(k8sClient.Update(ctx, clusterA)).To(Succeed())
163168

164169
t.Log("Waiting to receive the watch notification")
165-
g.Expect(<-c.ch).To(Equal("mapped-" + clusterA.Name))
170+
g.Expect(<-c.ch).To(Equal(getMappedName(clusterA.Name)))
166171

167172
t.Log("Ensuring no additional watch notifications arrive")
168173
g.Consistently(c.ch).ShouldNot(Receive())
@@ -184,7 +189,7 @@ func TestClusterCacheTracker(t *testing.T) {
184189
g.Expect(k8sClient.Update(ctx, clusterA)).To(Succeed())
185190

186191
t.Log("Waiting to receive the watch notification")
187-
g.Expect(<-c.ch).To(Equal("mapped-" + clusterA.Name))
192+
g.Expect(<-c.ch).To(Equal(getMappedName(clusterA.Name)))
188193

189194
t.Log("Ensuring no additional watch notifications arrive")
190195
g.Consistently(c.ch).ShouldNot(Receive())

controlplane/kubeadm/internal/controllers/helpers_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,8 @@ func TestCloneConfigsAndGenerateMachine(t *testing.T) {
374374
g.Expect(env.GetAPIReader().List(ctx, machineList, client.InNamespace(cluster.Namespace))).To(Succeed())
375375
g.Expect(machineList.Items).To(HaveLen(1))
376376

377-
for _, m := range machineList.Items {
377+
for i := range machineList.Items {
378+
m := machineList.Items[i]
378379
g.Expect(m.Namespace).To(Equal(cluster.Namespace))
379380
g.Expect(m.Name).NotTo(BeEmpty())
380381
g.Expect(m.Name).To(HavePrefix(kcp.Name))

controlplane/kubeadm/internal/workload_cluster_coredns_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,8 @@ func TestGetCoreDNSInfo(t *testing.T) {
13691369
expectErr: true,
13701370
},
13711371
}
1372-
for _, tt := range tests {
1372+
for i := range tests {
1373+
tt := tests[i]
13731374
t.Run(tt.name, func(t *testing.T) {
13741375
g := NewWithT(t)
13751376
fakeClient := fake.NewClientBuilder().WithObjects(tt.objs...).Build()
@@ -1433,7 +1434,8 @@ func TestUpdateCoreDNSImageInfoInKubeadmConfigMap(t *testing.T) {
14331434
`),
14341435
},
14351436
}
1436-
for _, tt := range tests {
1437+
for i := range tests {
1438+
tt := tests[i]
14371439
t.Run(tt.name, func(t *testing.T) {
14381440
g := NewWithT(t)
14391441
fakeClient := fake.NewClientBuilder().WithObjects(&corev1.ConfigMap{

controlplane/kubeadm/internal/workload_cluster_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ func TestUpdateKubeProxyImageInfo(t *testing.T) {
218218
},
219219
}
220220

221-
for _, tt := range tests {
221+
for i := range tests {
222+
tt := tests[i]
222223
t.Run(tt.name, func(t *testing.T) {
223224
gs := NewWithT(t)
224225

exp/internal/controllers/machinepool_controller_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,8 @@ func TestReconcileMachinePoolRequest(t *testing.T) {
409409
},
410410
}
411411

412-
for _, tc := range testCases {
412+
for i := range testCases {
413+
tc := testCases[i]
413414
t.Run("machinePool should be "+tc.machinePool.Name, func(t *testing.T) {
414415
g := NewWithT(t)
415416

exp/internal/webhooks/machinepool_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,8 @@ func TestMachinePoolVersionValidation(t *testing.T) {
296296
},
297297
}
298298

299-
for _, tt := range tests {
299+
for i := range tests {
300+
tt := tests[i]
300301
t.Run(tt.name, func(t *testing.T) {
301302
g := NewWithT(t)
302303

exp/ipam/internal/webhooks/ipaddress_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ func TestIPAddressValidateCreate(t *testing.T) {
156156
},
157157
}
158158

159-
for _, tt := range tests {
159+
for i := range tests {
160+
tt := tests[i]
160161
t.Run(tt.name, func(t *testing.T) {
161162
g := NewWithT(t)
162163
scheme := runtime.NewScheme()
@@ -214,7 +215,8 @@ func TestIPAddressValidateUpdate(t *testing.T) {
214215
},
215216
}
216217

217-
for _, tt := range tests {
218+
for i := range tests {
219+
tt := tests[i]
218220
t.Run(tt.name, func(t *testing.T) {
219221
g := NewWithT(t)
220222
scheme := runtime.NewScheme()

0 commit comments

Comments
 (0)