Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃尡 Bump golangci-lint to v1.47.1 #6943

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.17
go-version: 1.18.4
- 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}}
22 changes: 22 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,28 @@ linters:
- whitespace

linters-settings:
revive:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the slow performance of revive is tracked as an issue, maybe add a comment to re-enable them once a future release improves performance?

rules:
- name: context-keys-type
disabled: true
- name: errorf
disabled: true
- name: time-naming
disabled: true
- name: unexported-return
disabled: true
- name: unhandled-error
disabled: true
- name: var-declaration
disabled: true
- name: modifies-value-receiver
disabled: true
- name: range-val-address
disabled: true
- name: string-of-int
disabled: true
- name: time-equal
disabled: true
godot:
# declarations - for top level declaration comments (default);
# toplevel - for top level comments;
Expand Down
6 changes: 3 additions & 3 deletions controllers/remote/cluster_cache_reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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())
}
})
Expand Down
2 changes: 1 addition & 1 deletion internal/controllers/topology/cluster/patches/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (t *requestItemBuilder) WithHolder(object client.Object, fieldPath string)
}

// uuidGenerator is defined as a package variable to enable changing it during testing.
var uuidGenerator func() types.UID = uuid.NewUUID
var uuidGenerator = uuid.NewUUID

// Build builds a GeneratePatchesRequestItem.
func (t *requestItemBuilder) Build() (*runtimehooksv1.GeneratePatchesRequestItem, error) {
Expand Down
7 changes: 2 additions & 5 deletions internal/webhooks/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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"))
Expand Down
4 changes: 1 addition & 3 deletions internal/webhooks/clusterclass_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 0 additions & 2 deletions util/container/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down