Skip to content

Commit 6035293

Browse files
authored
Merge pull request #431 from dave-tucker/golangci-lint-v2
chore: Update to golang-ci-lint v2
2 parents 0940d78 + 9fa42e7 commit 6035293

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
@@ -145,7 +145,7 @@ OPERATOR_SDK ?= $(LOCALBIN)/operator-sdk
145145
KUSTOMIZE_VERSION ?= v3.8.7
146146
CONTROLLER_TOOLS_VERSION ?= v0.15.0
147147
OPERATOR_SDK_VERSION ?= v1.27.0
148-
GOLANGCI_LINT_VERSION = v1.64.2
148+
GOLANGCI_LINT_VERSION = v2.0.2
149149

150150
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
151151
.PHONY: kustomize
@@ -285,7 +285,7 @@ verify: ## Verify all the autogenerated code
285285
.PHONY: prereqs
286286
prereqs:
287287
@echo "### Test if prerequisites are met, and installing missing dependencies"
288-
GOFLAGS="" go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}
288+
GOFLAGS="" go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}
289289

290290
.PHONY: lint
291291
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
@@ -696,7 +696,7 @@ func (r *ClBpfApplicationReconciler) isLoaded(ctx context.Context) bool {
696696
// This should never happen because the bpfman load is all or nothing,
697697
// and we aren't allowing users to add or remove programs from an
698698
// existing BpfApplication. However, if it does happen, log an error.
699-
r.Logger.Error(fmt.Errorf("inconsistent program load state"),
699+
r.Logger.Error(fmt.Errorf("inconsistent program load state"), "inconsistent program load state",
700700
"allProgramsLoaded", allProgramsLoaded, "someProgramsLoaded", someProgramsLoaded)
701701
}
702702

controllers/bpfman-agent/ns_application_program.go

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

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, isOpenshift
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, isOpenshift
343343
}
344344
}
345345
}
346+
default:
347+
// Do nothing
346348
}
347349
}
348350

0 commit comments

Comments
 (0)