Skip to content

Commit f1a5fff

Browse files
committed
Bump golangci-lint to 1.52.1 and fix findings
1 parent 8ecf669 commit f1a5fff

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ jobs:
3030
- name: golangci-lint
3131
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # tag=v3.4.0
3232
with:
33-
version: v1.51.2
33+
version: v1.52.1
3434
working-directory: ${{matrix.working-directory}}

controlplane/kubeadm/internal/controllers/scale_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ func TestKubeadmControlPlaneReconciler_scaleUpControlPlane(t *testing.T) {
226226
// No new machine should be created.
227227
// Note: expected length is 0 because no machine is created and hence no machine is on the API server.
228228
// Other machines are in-memory only during the test.
229-
g.Expect(controlPlaneMachines.Items).To(HaveLen(0))
229+
g.Expect(controlPlaneMachines.Items).To(BeEmpty())
230230

231231
endMachines := collections.FromMachineList(controlPlaneMachines)
232232
for _, m := range endMachines {

internal/controllers/machine/machine_controller_phases_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ func TestReconcileMachinePhases(t *testing.T) {
394394
return false
395395
}
396396
g.Expect(machine.Status.GetTypedPhase()).To(Equal(clusterv1.MachinePhaseRunning))
397-
g.Expect(machine.Status.Addresses).To(HaveLen(0))
397+
g.Expect(machine.Status.Addresses).To(BeEmpty())
398398
// Verify that the LastUpdated timestamp was updated
399399
g.Expect(machine.Status.LastUpdated).NotTo(BeNil())
400400
g.Expect(machine.Status.LastUpdated.After(lastUpdated.Time)).To(BeTrue())

internal/controllers/topology/cluster/conditions.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,19 +103,19 @@ func (r *Reconciler) reconcileTopologyReconciledCondition(s *scope.Scope, cluste
103103

104104
switch {
105105
case s.UpgradeTracker.ControlPlane.PendingUpgrade:
106-
msgBuilder.WriteString(fmt.Sprintf("Control plane upgrade to %s on hold.", s.Blueprint.Topology.Version))
106+
fmt.Fprintf(msgBuilder, "Control plane upgrade to %s on hold.", s.Blueprint.Topology.Version)
107107
reason = clusterv1.TopologyReconciledControlPlaneUpgradePendingReason
108108
case s.UpgradeTracker.MachineDeployments.PendingUpgrade():
109-
msgBuilder.WriteString(fmt.Sprintf("MachineDeployment(s) %s upgrade to version %s on hold.",
109+
fmt.Fprintf(msgBuilder, "MachineDeployment(s) %s upgrade to version %s on hold.",
110110
computeMachineDeploymentNameList(s.UpgradeTracker.MachineDeployments.PendingUpgradeNames()),
111111
s.Blueprint.Topology.Version,
112-
))
112+
)
113113
reason = clusterv1.TopologyReconciledMachineDeploymentsUpgradePendingReason
114114
case s.UpgradeTracker.MachineDeployments.DeferredUpgrade():
115-
msgBuilder.WriteString(fmt.Sprintf("MachineDeployment(s) %s upgrade to version %s deferred.",
115+
fmt.Fprintf(msgBuilder, "MachineDeployment(s) %s upgrade to version %s deferred.",
116116
computeMachineDeploymentNameList(s.UpgradeTracker.MachineDeployments.DeferredUpgradeNames()),
117117
s.Blueprint.Topology.Version,
118-
))
118+
)
119119
reason = clusterv1.TopologyReconciledMachineDeploymentsUpgradeDeferredReason
120120
}
121121

@@ -128,15 +128,15 @@ func (r *Reconciler) reconcileTopologyReconciledCondition(s *scope.Scope, cluste
128128
if err != nil {
129129
return errors.Wrap(err, "failed to get control plane spec version")
130130
}
131-
msgBuilder.WriteString(fmt.Sprintf(" Control plane is upgrading to version %s", *cpVersion))
131+
fmt.Fprintf(msgBuilder, " Control plane is upgrading to version %s", *cpVersion)
132132

133133
case s.UpgradeTracker.ControlPlane.IsScaling:
134134
msgBuilder.WriteString(" Control plane is reconciling desired replicas")
135135

136136
case s.Current.MachineDeployments.IsAnyRollingOut():
137-
msgBuilder.WriteString(fmt.Sprintf(" MachineDeployment(s) %s are rolling out",
137+
fmt.Fprintf(msgBuilder, " MachineDeployment(s) %s are rolling out",
138138
computeMachineDeploymentNameList(s.UpgradeTracker.MachineDeployments.RolloutNames()),
139-
))
139+
)
140140
}
141141

142142
conditions.Set(

test/framework/machinedeployment_helpers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ func ScaleAndWaitMachineDeploymentTopology(ctx context.Context, input ScaleAndWa
527527
Expect(input.ClusterProxy).ToNot(BeNil(), "Invalid argument. input.ClusterProxy can't be nil when calling ScaleAndWaitMachineDeployment")
528528
Expect(input.Cluster).ToNot(BeNil(), "Invalid argument. input.Cluster can't be nil when calling ScaleAndWaitMachineDeployment")
529529
Expect(input.Cluster.Spec.Topology.Workers).ToNot(BeNil(), "Invalid argument. input.Cluster must have MachineDeployment topologies")
530-
Expect(len(input.Cluster.Spec.Topology.Workers.MachineDeployments) >= 1).To(BeTrue(), "Invalid argument. input.Cluster must have at least one MachineDeployment topology")
530+
Expect(len(input.Cluster.Spec.Topology.Workers.MachineDeployments)).NotTo(BeEmpty(), "Invalid argument. input.Cluster must have at least one MachineDeployment topology")
531531

532532
mdTopology := input.Cluster.Spec.Topology.Workers.MachineDeployments[0]
533533
log.Logf("Scaling machine deployment topology %s from %d to %d replicas", mdTopology.Name, *mdTopology.Replicas, input.Replicas)

test/framework/namespace_helpers.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,13 @@ func WatchNamespaceEvents(ctx context.Context, input WatchNamespaceEventsInput)
147147
_, err = eventInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{
148148
AddFunc: func(obj interface{}) {
149149
e := obj.(*corev1.Event)
150-
_, _ = f.WriteString(fmt.Sprintf("[New Event] %s\n\tresource: %s/%s/%s\n\treason: %s\n\tmessage: %s\n\tfull: %#v\n",
151-
klog.KObj(e), e.InvolvedObject.APIVersion, e.InvolvedObject.Kind, e.InvolvedObject.Name, e.Reason, e.Message, e))
150+
_, _ = fmt.Fprintf(f, "[New Event] %s\n\tresource: %s/%s/%s\n\treason: %s\n\tmessage: %s\n\tfull: %#v\n",
151+
klog.KObj(e), e.InvolvedObject.APIVersion, e.InvolvedObject.Kind, e.InvolvedObject.Name, e.Reason, e.Message, e)
152152
},
153153
UpdateFunc: func(_, obj interface{}) {
154154
e := obj.(*corev1.Event)
155-
_, _ = f.WriteString(fmt.Sprintf("[Updated Event] %s\n\tresource: %s/%s/%s\n\treason: %s\n\tmessage: %s\n\tfull: %#v\n",
156-
klog.KObj(e), e.InvolvedObject.APIVersion, e.InvolvedObject.Kind, e.InvolvedObject.Name, e.Reason, e.Message, e))
155+
_, _ = fmt.Fprintf(f, "[Updated Event] %s\n\tresource: %s/%s/%s\n\treason: %s\n\tmessage: %s\n\tfull: %#v\n",
156+
klog.KObj(e), e.InvolvedObject.APIVersion, e.InvolvedObject.Kind, e.InvolvedObject.Name, e.Reason, e.Message, e)
157157
},
158158
DeleteFunc: func(obj interface{}) {},
159159
})

0 commit comments

Comments
 (0)