Skip to content

Commit 2aee0dc

Browse files
committed
Fix lints.
1 parent bdaf77d commit 2aee0dc

5 files changed

Lines changed: 9 additions & 8 deletions

File tree

.golangci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ linters:
88
- dupl
99
- errcheck
1010
- ginkgolinter
11-
- goconst
11+
# - goconst # disabled because it started triggering on field names
1212
- gocyclo
1313
- govet
1414
- ineffassign
@@ -37,6 +37,10 @@ linters:
3737
# - lll
3838
- dupl
3939
path: api/
40+
- linters:
41+
- staticcheck
42+
path: api/
43+
rule: SA1019
4044
- linters:
4145
- dupl
4246
# - lll

internal/controller/topology_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ func (r *TopologyReconciler) getTopLevelField(obj topology.TopologyResource, pat
215215
return nil
216216
}
217217
value := reflect.ValueOf(obj).Elem().FieldByName(path)
218-
if value.Kind() == reflect.Ptr {
218+
if value.Kind() == reflect.Pointer {
219219
value = value.Elem()
220220
}
221221
if !value.IsValid() || !value.CanAddr() {

internal/controller/user_controller.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"k8s.io/apimachinery/pkg/runtime"
2424
"k8s.io/apimachinery/pkg/types"
2525
clientretry "k8s.io/client-go/util/retry"
26-
"k8s.io/utils/ptr"
2726
ctrl "sigs.k8s.io/controller-runtime"
2827
"sigs.k8s.io/controller-runtime/pkg/client"
2928
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
@@ -98,7 +97,7 @@ func (r *UserReconciler) declareCredentials(ctx context.Context, user *topology.
9897
// https://github.com/rabbitmq/messaging-topology-operator/issues/194
9998
for i := range credentialSecret.OwnerReferences {
10099
if credentialSecret.ObjectMeta.OwnerReferences[i].Kind == user.Kind {
101-
credentialSecret.ObjectMeta.OwnerReferences[i].BlockOwnerDeletion = ptr.To(false)
100+
credentialSecret.ObjectMeta.OwnerReferences[i].BlockOwnerDeletion = new(false)
102101
}
103102
}
104103
return nil

test/system/deletion_system_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
topology "github.com/rabbitmq/messaging-topology-operator/api/v1beta1"
88
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
99
"k8s.io/apimachinery/pkg/runtime"
10-
"k8s.io/utils/ptr"
1110

1211
. "github.com/onsi/ginkgo/v2"
1312
. "github.com/onsi/gomega"
@@ -27,7 +26,7 @@ var _ = Describe("Deletion", func() {
2726

2827
BeforeEach(func() {
2928
targetCluster = basicTestRabbitmqCluster("to-be-deleted", namespace)
30-
targetCluster.Spec.TerminationGracePeriodSeconds = ptr.To(int64(10))
29+
targetCluster.Spec.TerminationGracePeriodSeconds = new(int64(10))
3130
setupTestRabbitmqCluster(k8sClient, targetCluster)
3231
targetClusterRef := topology.RabbitmqClusterReference{Name: targetCluster.Name}
3332
exchange = topology.Exchange{

test/system/utils_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
"k8s.io/client-go/kubernetes"
2525
"k8s.io/client-go/rest"
2626
"k8s.io/client-go/tools/clientcmd"
27-
"k8s.io/utils/ptr"
2827
)
2928

3029
// Useful for small Openshift environment while updating status takes a long time
@@ -259,7 +258,7 @@ func basicTestRabbitmqCluster(name, namespace string) *rabbitmqv1beta1.RabbitmqC
259258
Namespace: namespace,
260259
},
261260
Spec: rabbitmqv1beta1.RabbitmqClusterSpec{
262-
Replicas: ptr.To(int32(1)),
261+
Replicas: new(int32(1)),
263262
Image: "rabbitmq:4-management",
264263
Resources: &corev1.ResourceRequirements{
265264
Requests: corev1.ResourceList{

0 commit comments

Comments
 (0)