From 8a524c8841085ab6fced5dc271ec1ac1688f68e9 Mon Sep 17 00:00:00 2001 From: Stefan Bueringer Date: Mon, 18 Jul 2022 13:57:57 +0200 Subject: [PATCH] Bump golangci-lint to v1.47.0 --- .github/workflows/golangci-lint.yml | 2 +- controllers/remote/cluster_cache_reconciler_test.go | 6 +++--- internal/webhooks/cluster_test.go | 7 ++----- internal/webhooks/clusterclass_test.go | 4 +--- util/container/image.go | 2 -- 5 files changed, 7 insertions(+), 14 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 5f21bfad46a5..4344dfc048f5 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -25,5 +25,5 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v3.2.0 with: - version: v1.44.0 + version: v1.47.1 working-directory: ${{matrix.working-directory}} diff --git a/controllers/remote/cluster_cache_reconciler_test.go b/controllers/remote/cluster_cache_reconciler_test.go index b818bcfe765f..c9567cbf0cd7 100644 --- a/controllers/remote/cluster_cache_reconciler_test.go +++ b/controllers/remote/cluster_cache_reconciler_test.go @@ -45,7 +45,7 @@ func TestClusterCacheReconciler(t *testing.T) { // createAndWatchCluster creates a new cluster and ensures the clusterCacheTracker has a clusterAccessor for it createAndWatchCluster := func(clusterName string, testNamespace *corev1.Namespace, g *WithT) { - t.Log(fmt.Sprintf("Creating a cluster %q", clusterName)) + t.Logf("Creating a cluster %q", clusterName) testCluster := &clusterv1.Cluster{ ObjectMeta: metav1.ObjectMeta{ Name: clusterName, @@ -136,7 +136,7 @@ func TestClusterCacheReconciler(t *testing.T) { defer teardown(t, g, testNamespace) for _, clusterName := range []string{"cluster-1", "cluster-2", "cluster-3"} { - t.Log(fmt.Sprintf("Deleting cluster %q", clusterName)) + t.Logf("Deleting cluster %q", clusterName) obj := &clusterv1.Cluster{ ObjectMeta: metav1.ObjectMeta{ Namespace: testNamespace.Name, @@ -145,7 +145,7 @@ func TestClusterCacheReconciler(t *testing.T) { } g.Expect(k8sClient.Delete(ctx, obj)).To(Succeed()) - t.Log(fmt.Sprintf("Checking cluster %q's clusterAccessor is removed", clusterName)) + t.Logf("Checking cluster %q's clusterAccessor is removed", clusterName) g.Eventually(func() bool { return cct.clusterAccessorExists(util.ObjectKey(obj)) }, timeout).Should(BeFalse()) } }) diff --git a/internal/webhooks/cluster_test.go b/internal/webhooks/cluster_test.go index c8033aed6394..b06be6dd37c8 100644 --- a/internal/webhooks/cluster_test.go +++ b/internal/webhooks/cluster_test.go @@ -47,9 +47,7 @@ func TestClusterDefaultNamespaces(t *testing.T) { }, } webhook := &Cluster{} - tFunc := util.CustomDefaultValidateTest(ctx, c, webhook) - - t.Run("for Cluster", tFunc) + t.Run("for Cluster", util.CustomDefaultValidateTest(ctx, c, webhook)) g.Expect(webhook.Default(ctx, c)).To(Succeed()) g.Expect(c.Spec.InfrastructureRef.Namespace).To(Equal(c.Namespace)) @@ -351,8 +349,7 @@ func TestClusterDefaultTopologyVersion(t *testing.T) { // Create the webhook and add the fakeClient as its client. webhook := &Cluster{Client: fakeClient} - tFunc := util.CustomDefaultValidateTest(ctx, c, webhook) - t.Run("for Cluster", tFunc) + t.Run("for Cluster", util.CustomDefaultValidateTest(ctx, c, webhook)) g.Expect(webhook.Default(ctx, c)).To(Succeed()) g.Expect(c.Spec.Topology.Version).To(HavePrefix("v")) diff --git a/internal/webhooks/clusterclass_test.go b/internal/webhooks/clusterclass_test.go index a7c827cb7900..278448870501 100644 --- a/internal/webhooks/clusterclass_test.go +++ b/internal/webhooks/clusterclass_test.go @@ -77,9 +77,7 @@ func TestClusterClassDefaultNamespaces(t *testing.T) { // Create the webhook and add the fakeClient as its client. webhook := &ClusterClass{Client: fakeClient} - tFunc := util.CustomDefaultValidateTest(ctx, in, webhook) - - t.Run("for ClusterClass", tFunc) + t.Run("for ClusterClass", util.CustomDefaultValidateTest(ctx, in, webhook)) g := NewWithT(t) g.Expect(webhook.Default(ctx, in)).To(Succeed()) diff --git a/util/container/image.go b/util/container/image.go index fa11667596f3..4da11c508d42 100644 --- a/util/container/image.go +++ b/util/container/image.go @@ -18,10 +18,8 @@ limitations under the License. package container import ( - // Import the crypto sha256 algorithm for the docker image parser to work _ "crypto/sha256" - // Import the crypto/sha512 algorithm for the docker image parser to work with 384 and 512 sha hashes _ "crypto/sha512" "fmt"