Skip to content

Commit 751ce4e

Browse files
committed
fix linting
1 parent 8dbaa6e commit 751ce4e

File tree

8 files changed

+13
-8
lines changed

8 files changed

+13
-8
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ jobs:
2323
- name: golangci-lint
2424
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1
2525
with:
26-
version: v1.58
26+
version: v1.61

.golangci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,12 @@ issues:
148148
- linters:
149149
- gosec
150150
text: "G108: Profiling endpoint is automatically exposed on /debug/pprof"
151+
- linters:
152+
- gosec
153+
text: "G115: integer overflow conversion int -> int32"
154+
- linters:
155+
- govet
156+
text: "printf: non-constant format string in call to sigs.k8s.io/cluster-api/util/conditions.MarkFalse"
151157
- linters:
152158
- revive
153159
text: "exported: exported method .*\\.(Reconcile|SetupWithManager|SetupWebhookWithManager) should have comment or be unexported"

cloud/scope/managedcontrolplane.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func (s *ManagedControlPlaneScope) GetCredential() *Credential {
180180

181181
// GetAllNodePools gets all node pools for the control plane.
182182
func (s *ManagedControlPlaneScope) GetAllNodePools(ctx context.Context) ([]infrav1exp.GCPManagedMachinePool, []clusterv1exp.MachinePool, error) {
183-
if s.AllManagedMachinePools == nil || len(s.AllManagedMachinePools) == 0 {
183+
if len(s.AllManagedMachinePools) == 0 {
184184
listOptions := []client.ListOption{
185185
client.InNamespace(s.GCPManagedControlPlane.Namespace),
186186
client.MatchingLabels(map[string]string{clusterv1.ClusterNameLabel: s.Cluster.Name}),

cloud/scope/managedmachinepool.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ func ConvertToSdkNodePool(nodePool infrav1exp.GCPManagedMachinePool, machinePool
237237
sdkNodePool.Config.DiskType = string(*nodePool.Spec.DiskType)
238238
}
239239
if nodePool.Spec.DiskSizeGB != nil {
240-
sdkNodePool.Config.DiskSizeGb = int32(*nodePool.Spec.DiskSizeGB)
240+
sdkNodePool.Config.DiskSizeGb = int32(*nodePool.Spec.DiskSizeGB) //nolint:gosec
241241
}
242242
if len(nodePool.Spec.NodeNetwork.Tags) != 0 {
243243
sdkNodePool.Config.Tags = nodePool.Spec.NodeNetwork.Tags

controllers/suite_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,8 @@ func init() {
5050
func TestAPIs(t *testing.T) {
5151
RegisterFailHandler(Fail)
5252
// fetch the current config
53-
suiteConfig, reporterConfig := GinkgoConfiguration()
53+
_, reporterConfig := GinkgoConfiguration()
5454
// adjust it
55-
suiteConfig.FailFast = true
5655
reporterConfig.FullTrace = true
5756
RunSpecs(t, "Controller Suite", reporterConfig)
5857
}

exp/api/v1beta1/webhook_suite_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func TestAPIs(t *testing.T) {
6060
var _ = BeforeSuite(func() {
6161
logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))
6262

63-
ctx, cancel = context.WithCancel(context.TODO())
63+
ctx, cancel = context.WithCancel(context.TODO()) //nolint:fatcontext
6464

6565
By("bootstrapping test environment")
6666
testEnv = &envtest.Environment{

exp/controllers/gcpmanagedcontrolplane_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func (r *GCPManagedControlPlaneReconciler) Reconcile(ctx context.Context, req ct
121121
Namespace: gcpManagedControlPlane.Namespace,
122122
Name: cluster.Spec.InfrastructureRef.Name,
123123
}
124-
if err := r.Client.Get(ctx, key, managedCluster); err != nil || managedCluster == nil {
124+
if err := r.Client.Get(ctx, key, managedCluster); err != nil {
125125
log.Error(err, "Failed to retrieve GCPManagedCluster from the API Server")
126126
return ctrl.Result{}, err
127127
}

exp/controllers/gcpmanagedmachinepool_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ func (r *GCPManagedMachinePoolReconciler) Reconcile(ctx context.Context, req ctr
266266
Name: cluster.Spec.InfrastructureRef.Name,
267267
}
268268
gcpManagedCluster := &infrav1exp.GCPManagedCluster{}
269-
if err := r.Client.Get(ctx, gcpManagedClusterKey, gcpManagedCluster); err != nil || gcpManagedCluster == nil {
269+
if err := r.Client.Get(ctx, gcpManagedClusterKey, gcpManagedCluster); err != nil {
270270
log.Error(err, "Failed to retrieve GCPManagedCluster from the API Server")
271271
return ctrl.Result{}, err
272272
}

0 commit comments

Comments
 (0)