Skip to content

Commit 1aed1c3

Browse files
committed
Repair linter.
1 parent 0241cb3 commit 1aed1c3

File tree

6 files changed

+26
-26
lines changed

6 files changed

+26
-26
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,5 @@ jobs:
1717
with:
1818
go-version: '~1.23'
1919

20-
- name: Run linter
20+
- name: Run Linter
2121
uses: golangci/golangci-lint-action@v6
22-
with:
23-
version: v1.59

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
193193
KUSTOMIZE_VERSION ?= v5.4.3
194194
CONTROLLER_TOOLS_VERSION ?= v0.16.4
195195
ENVTEST_VERSION ?= release-0.19
196-
GOLANGCI_LINT_VERSION ?= v1.59.1
196+
GOLANGCI_LINT_VERSION ?= v1.61.0
197197

198198
.PHONY: kustomize
199199
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.

internal/controller/metalstackcluster_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ func (r *MetalStackClusterReconciler) status(ctx context.Context, infraCluster *
388388

389389
conditionUpdates <- func() {
390390
if err != nil {
391-
conditions.MarkFalse(infraCluster, v1alpha1.ClusterNodeNetworkEnsured, "InternalError", clusterv1.ConditionSeverityError, err.Error())
391+
conditions.MarkFalse(infraCluster, v1alpha1.ClusterNodeNetworkEnsured, "InternalError", clusterv1.ConditionSeverityError, "%s", err.Error())
392392
return
393393
}
394394

@@ -417,7 +417,7 @@ func (r *MetalStackClusterReconciler) status(ctx context.Context, infraCluster *
417417

418418
conditionUpdates <- func() {
419419
if err != nil && !apierrors.IsNotFound(err) {
420-
conditions.MarkFalse(infraCluster, v1alpha1.ClusterFirewallDeploymentReady, "InternalError", clusterv1.ConditionSeverityError, err.Error())
420+
conditions.MarkFalse(infraCluster, v1alpha1.ClusterFirewallDeploymentReady, "InternalError", clusterv1.ConditionSeverityError, "%s", err.Error())
421421
return
422422
}
423423

internal/controller/metalstackmachine_controller.go

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,13 @@ func (r *MetalStackMachineReconciler) SetupWithManager(mgr ctrl.Manager) error {
167167
Complete(r)
168168
}
169169

170-
func (r *MetalStackMachineReconciler) create(ctx context.Context, log logr.Logger, infraMachine *v1alpha1.MetalStackMachine, infraCluster *v1alpha1.MetalStackCluster) error {
170+
func (r *MetalStackMachineReconciler) create(ctx context.Context, _ logr.Logger, infraMachine *v1alpha1.MetalStackMachine, infraCluster *v1alpha1.MetalStackCluster) error {
171171
helper, err := patch.NewHelper(infraMachine, r.Client)
172172
if err != nil {
173173
return err
174174
}
175175

176-
//TODO: Find any existing machine by tag first
176+
// TODO: Find any existing machine by tag first
177177
const TagInfraMachineID = "machine.metal-stack.infrastructure.cluster.x-k8s.io/id"
178178
infraMachineOwnerTag := fmt.Sprintf("%s=%s", TagInfraMachineID, infraMachine.GetUID())
179179

@@ -218,8 +218,8 @@ func (r *MetalStackMachineReconciler) create(ctx context.Context, log logr.Logge
218218
return nil
219219
}
220220

221-
func (r *MetalStackMachineReconciler) reconcile(ctx context.Context, log logr.Logger, infraMachine *v1alpha1.MetalStackMachine, infraCluster *v1alpha1.MetalStackCluster) error {
222-
_, err := r.findProviderMachine(ctx, infraMachine, infraCluster)
221+
func (r *MetalStackMachineReconciler) reconcile(ctx context.Context, _ logr.Logger, infraMachine *v1alpha1.MetalStackMachine, infraCluster *v1alpha1.MetalStackCluster) error {
222+
err := r.findProviderMachine(ctx, infraMachine, infraCluster)
223223
if err != nil && !errors.Is(err, errProviderMachineNotFound) {
224224
return err
225225
}
@@ -231,7 +231,7 @@ func (r *MetalStackMachineReconciler) reconcile(ctx context.Context, log logr.Lo
231231
}
232232

233233
func (r *MetalStackMachineReconciler) delete(ctx context.Context, log logr.Logger, infraMachine *v1alpha1.MetalStackMachine, infraCluster *v1alpha1.MetalStackCluster) error {
234-
_, err := r.findProviderMachine(ctx, infraMachine, infraCluster)
234+
err := r.findProviderMachine(ctx, infraMachine, infraCluster)
235235
if errors.Is(err, errProviderMachineNotFound) {
236236
// metal-stack machine already freed
237237
return nil
@@ -248,27 +248,29 @@ func (r *MetalStackMachineReconciler) delete(ctx context.Context, log logr.Logge
248248
return nil
249249
}
250250

251-
func (r *MetalStackMachineReconciler) status(ctx context.Context, infraMachine *v1alpha1.MetalStackMachine, infraCluster *v1alpha1.MetalStackCluster) error {
251+
func (r *MetalStackMachineReconciler) status(_ context.Context, _ *v1alpha1.MetalStackMachine, _ *v1alpha1.MetalStackCluster) error {
252252
return nil
253253
}
254254

255-
func (r *MetalStackMachineReconciler) findProviderMachine(ctx context.Context, infraMachine *v1alpha1.MetalStackMachine, infraCluster *v1alpha1.MetalStackCluster) (*models.V1MachineResponse, error) {
255+
func (r *MetalStackMachineReconciler) findProviderMachine(ctx context.Context, infraMachine *v1alpha1.MetalStackMachine, infraCluster *v1alpha1.MetalStackCluster) error {
256256
mfr := &models.V1MachineFindRequest{
257257
ID: infraMachine.Spec.ProviderID,
258258
AllocationProject: infraCluster.Spec.ProjectID,
259259
Tags: []string{fmt.Sprintf("%s%s", tag.ClusterID, infraCluster.GetUID())},
260260
}
261+
261262
resp, err := r.MetalClient.Machine().FindMachines(metalmachine.NewFindMachinesParamsWithContext(ctx).WithBody(mfr), nil)
262263
if err != nil {
263-
return nil, err
264+
return err
264265
}
266+
265267
switch len(resp.Payload) {
266268
case 0:
267269
// metal-stack machine already freed
268-
return nil, errProviderMachineNotFound
270+
return errProviderMachineNotFound
269271
case 1:
270-
return resp.Payload[0], nil
272+
return nil
271273
default:
272-
return nil, errProviderMachineTooManyFound
274+
return errProviderMachineTooManyFound
273275
}
274276
}

test/e2e/e2e_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,27 +93,27 @@ var _ = Describe("Manager", Ordered, func() {
9393
cmd := exec.Command("kubectl", "logs", controllerPodName, "-n", namespace)
9494
controllerLogs, err := utils.Run(cmd)
9595
if err == nil {
96-
_, _ = fmt.Fprintf(GinkgoWriter, fmt.Sprintf("Controller logs:\n %s", controllerLogs))
96+
_, _ = fmt.Fprintf(GinkgoWriter, "Controller logs:\n %s", controllerLogs)
9797
} else {
98-
_, _ = fmt.Fprintf(GinkgoWriter, fmt.Sprintf("Failed to get Controller logs: %s", err))
98+
_, _ = fmt.Fprintf(GinkgoWriter, "Failed to get Controller logs: %s", err)
9999
}
100100

101101
By("Fetching Kubernetes events")
102102
cmd = exec.Command("kubectl", "get", "events", "-n", namespace, "--sort-by=.lastTimestamp")
103103
eventsOutput, err := utils.Run(cmd)
104104
if err == nil {
105-
_, _ = fmt.Fprintf(GinkgoWriter, fmt.Sprintf("Kubernetes events:\n%s", eventsOutput))
105+
_, _ = fmt.Fprintf(GinkgoWriter, "Kubernetes events:\n%s", eventsOutput)
106106
} else {
107-
_, _ = fmt.Fprintf(GinkgoWriter, fmt.Sprintf("Failed to get Kubernetes events: %s", err))
107+
_, _ = fmt.Fprintf(GinkgoWriter, "Failed to get Kubernetes events: %s", err)
108108
}
109109

110110
By("Fetching curl-metrics logs")
111111
cmd = exec.Command("kubectl", "logs", "curl-metrics", "-n", namespace)
112112
metricsOutput, err := utils.Run(cmd)
113113
if err == nil {
114-
_, _ = fmt.Fprintf(GinkgoWriter, fmt.Sprintf("Metrics logs:\n %s", metricsOutput))
114+
_, _ = fmt.Fprintf(GinkgoWriter, "Metrics logs:\n %s", metricsOutput)
115115
} else {
116-
_, _ = fmt.Fprintf(GinkgoWriter, fmt.Sprintf("Failed to get curl-metrics logs: %s", err))
116+
_, _ = fmt.Fprintf(GinkgoWriter, "Failed to get curl-metrics logs: %s", err)
117117
}
118118

119119
By("Fetching controller manager pod description")
@@ -278,7 +278,7 @@ func serviceAccountToken() (string, error) {
278278

279279
// Parse the JSON output to extract the token
280280
var token tokenRequest
281-
err = json.Unmarshal([]byte(output), &token)
281+
err = json.Unmarshal(output, &token)
282282
g.Expect(err).NotTo(HaveOccurred())
283283

284284
out = token.Status.Token

test/utils/utils.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func IsPrometheusCRDsInstalled() bool {
9292
if err != nil {
9393
return false
9494
}
95-
crdList := GetNonEmptyLines(string(output))
95+
crdList := GetNonEmptyLines(output)
9696
for _, crd := range prometheusCRDs {
9797
for _, line := range crdList {
9898
if strings.Contains(line, crd) {
@@ -153,7 +153,7 @@ func IsCertManagerCRDsInstalled() bool {
153153
}
154154

155155
// Check if any of the Cert Manager CRDs are present
156-
crdList := GetNonEmptyLines(string(output))
156+
crdList := GetNonEmptyLines(output)
157157
for _, crd := range certManagerCRDs {
158158
for _, line := range crdList {
159159
if strings.Contains(line, crd) {

0 commit comments

Comments
 (0)