Skip to content

Commit 8373d59

Browse files
committed
Bump golangci-lint to v1.47.0
1 parent e29d7fb commit 8373d59

File tree

6 files changed

+12
-14
lines changed

6 files changed

+12
-14
lines changed

.github/workflows/golangci-lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ jobs:
2525
- name: golangci-lint
2626
uses: golangci/[email protected]
2727
with:
28-
version: v1.44.0
28+
version: v1.47.0
2929
working-directory: ${{matrix.working-directory}}

.golangci.yml

+5
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,11 @@ issues:
265265
- gocritic
266266
text: "deferInLoop: Possible resource leak, 'defer' is called in the 'for' loop"
267267
path: _test\.go
268+
# We want to keep the ANCHOR_END comments, gci would somehow drop them.
269+
- linters:
270+
- gci
271+
text: "File is not `gci`-ed with -skip-generated -s standard,default"
272+
path: .*condition_types.go
268273

269274
run:
270275
timeout: 10m

controllers/remote/cluster_cache_reconciler_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func TestClusterCacheReconciler(t *testing.T) {
4545

4646
// createAndWatchCluster creates a new cluster and ensures the clusterCacheTracker has a clusterAccessor for it
4747
createAndWatchCluster := func(clusterName string, testNamespace *corev1.Namespace, g *WithT) {
48-
t.Log(fmt.Sprintf("Creating a cluster %q", clusterName))
48+
t.Logf("Creating a cluster %q", clusterName)
4949
testCluster := &clusterv1.Cluster{
5050
ObjectMeta: metav1.ObjectMeta{
5151
Name: clusterName,
@@ -136,7 +136,7 @@ func TestClusterCacheReconciler(t *testing.T) {
136136
defer teardown(t, g, testNamespace)
137137

138138
for _, clusterName := range []string{"cluster-1", "cluster-2", "cluster-3"} {
139-
t.Log(fmt.Sprintf("Deleting cluster %q", clusterName))
139+
t.Logf("Deleting cluster %q", clusterName)
140140
obj := &clusterv1.Cluster{
141141
ObjectMeta: metav1.ObjectMeta{
142142
Namespace: testNamespace.Name,
@@ -145,7 +145,7 @@ func TestClusterCacheReconciler(t *testing.T) {
145145
}
146146
g.Expect(k8sClient.Delete(ctx, obj)).To(Succeed())
147147

148-
t.Log(fmt.Sprintf("Checking cluster %q's clusterAccessor is removed", clusterName))
148+
t.Logf("Checking cluster %q's clusterAccessor is removed", clusterName)
149149
g.Eventually(func() bool { return cct.clusterAccessorExists(util.ObjectKey(obj)) }, timeout).Should(BeFalse())
150150
}
151151
})

internal/webhooks/cluster_test.go

+2-5
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ func TestClusterDefaultNamespaces(t *testing.T) {
4747
},
4848
}
4949
webhook := &Cluster{}
50-
tFunc := util.CustomDefaultValidateTest(ctx, c, webhook)
51-
52-
t.Run("for Cluster", tFunc)
50+
t.Run("for Cluster", util.CustomDefaultValidateTest(ctx, c, webhook))
5351
g.Expect(webhook.Default(ctx, c)).To(Succeed())
5452

5553
g.Expect(c.Spec.InfrastructureRef.Namespace).To(Equal(c.Namespace))
@@ -351,8 +349,7 @@ func TestClusterDefaultTopologyVersion(t *testing.T) {
351349

352350
// Create the webhook and add the fakeClient as its client.
353351
webhook := &Cluster{Client: fakeClient}
354-
tFunc := util.CustomDefaultValidateTest(ctx, c, webhook)
355-
t.Run("for Cluster", tFunc)
352+
t.Run("for Cluster", util.CustomDefaultValidateTest(ctx, c, webhook))
356353
g.Expect(webhook.Default(ctx, c)).To(Succeed())
357354

358355
g.Expect(c.Spec.Topology.Version).To(HavePrefix("v"))

internal/webhooks/clusterclass_test.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@ func TestClusterClassDefaultNamespaces(t *testing.T) {
7777

7878
// Create the webhook and add the fakeClient as its client.
7979
webhook := &ClusterClass{Client: fakeClient}
80-
tFunc := util.CustomDefaultValidateTest(ctx, in, webhook)
81-
82-
t.Run("for ClusterClass", tFunc)
80+
t.Run("for ClusterClass", util.CustomDefaultValidateTest(ctx, in, webhook))
8381

8482
g := NewWithT(t)
8583
g.Expect(webhook.Default(ctx, in)).To(Succeed())

util/container/image.go

-2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ limitations under the License.
1818
package container
1919

2020
import (
21-
2221
// Import the crypto sha256 algorithm for the docker image parser to work
2322
_ "crypto/sha256"
24-
2523
// Import the crypto/sha512 algorithm for the docker image parser to work with 384 and 512 sha hashes
2624
_ "crypto/sha512"
2725
"fmt"

0 commit comments

Comments
 (0)