Skip to content

Commit 9fa42e7

Browse files
committed
chore: Update to golang-ci-lint v2
Signed-off-by: Dave Tucker <[email protected]>
1 parent cd81bc6 commit 9fa42e7

File tree

5 files changed

+32
-7
lines changed

5 files changed

+32
-7
lines changed

.golangci.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: "2"
2+
run:
3+
allow-parallel-runners: true
4+
linters:
5+
enable:
6+
- loggercheck
7+
exclusions:
8+
generated: lax
9+
presets:
10+
- comments
11+
- common-false-positives
12+
- legacy
13+
- std-error-handling
14+
rules:
15+
- linters:
16+
- staticcheck
17+
text: "QF1008:"
18+
# Exclude `lll` issues for long lines with `go:generate`.
19+
formatters:
20+
enable:
21+
- gofmt
22+
exclusions:
23+
generated: lax

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ OPERATOR_SDK ?= $(LOCALBIN)/operator-sdk
132132
KUSTOMIZE_VERSION ?= v3.8.7
133133
CONTROLLER_TOOLS_VERSION ?= v0.15.0
134134
OPERATOR_SDK_VERSION ?= v1.27.0
135-
GOLANGCI_LINT_VERSION = v1.64.2
135+
GOLANGCI_LINT_VERSION = v2.0.2
136136

137137
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
138138
.PHONY: kustomize
@@ -272,7 +272,7 @@ verify: ## Verify all the autogenerated code
272272
.PHONY: prereqs
273273
prereqs:
274274
@echo "### Test if prerequisites are met, and installing missing dependencies"
275-
GOFLAGS="" go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}
275+
GOFLAGS="" go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}
276276

277277
.PHONY: lint
278278
lint: prereqs ## Run linter (golangci-lint).

controllers/bpfman-agent/cl_application_program.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ func (r *ClBpfApplicationReconciler) isLoaded(ctx context.Context) bool {
695695
// This should never happen because the bpfman load is all or nothing,
696696
// and we aren't allowing users to add or remove programs from an
697697
// existing BpfApplication. However, if it does happen, log an error.
698-
r.Logger.Error(fmt.Errorf("inconsistent program load state"),
698+
r.Logger.Error(fmt.Errorf("inconsistent program load state"), "inconsistent program load state",
699699
"allProgramsLoaded", allProgramsLoaded, "someProgramsLoaded", someProgramsLoaded)
700700
}
701701

controllers/bpfman-agent/ns_application_program.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ func (r *NsBpfApplicationReconciler) isLoaded(ctx context.Context) bool {
612612
// This should never happen because the bpfman load is all or nothing,
613613
// and we aren't allowing users to add or remove programs from an
614614
// existing BpfApplication. However, if it does happen, log an error.
615-
r.Logger.Error(fmt.Errorf("inconsistent program load state"),
615+
r.Logger.Error(fmt.Errorf("inconsistent program load state"), "inconsistent program load state",
616616
"allProgramsLoaded", allProgramsLoaded, "someProgramsLoaded", someProgramsLoaded)
617617
}
618618

controllers/bpfman-operator/configmap.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,11 +324,11 @@ func LoadAndConfigureBpfmanDs(config *corev1.ConfigMap, path string) *appsv1.Dae
324324
staticBpfmanDeployment.Namespace = config.Namespace
325325
staticBpfmanDeployment.Spec.Template.Spec.AutomountServiceAccountToken = ptr.To(true)
326326
for cindex, container := range staticBpfmanDeployment.Spec.Template.Spec.Containers {
327-
if container.Name == internal.BpfmanContainerName {
327+
switch container.Name {
328+
case internal.BpfmanContainerName:
328329
staticBpfmanDeployment.Spec.Template.Spec.Containers[cindex].Image = bpfmanImage
329-
} else if container.Name == internal.BpfmanAgentContainerName {
330+
case internal.BpfmanAgentContainerName:
330331
staticBpfmanDeployment.Spec.Template.Spec.Containers[cindex].Image = bpfmanAgentImage
331-
332332
for aindex, arg := range container.Args {
333333
if bpfmanHealthProbeAddr != "" {
334334
if strings.Contains(arg, "health-probe-bind-address") {
@@ -343,6 +343,8 @@ func LoadAndConfigureBpfmanDs(config *corev1.ConfigMap, path string) *appsv1.Dae
343343
}
344344
}
345345
}
346+
default:
347+
// Do nothing
346348
}
347349
}
348350
controllerutil.AddFinalizer(staticBpfmanDeployment, internal.BpfmanOperatorFinalizer)

0 commit comments

Comments
 (0)