ci: bump to golangi-lint v2

The config file is migrated using golangci-lint migrate. Three
new staticcheck checks got disabled (QF100x, 1,4, and 8).

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
This commit is contained in:
Mikko Ylinen 2025-04-01 09:10:07 +03:00
parent e5b2264fcc
commit d8eee5022f
3 changed files with 70 additions and 52 deletions

View File

@ -44,9 +44,9 @@ jobs:
sudo apt-get update sudo apt-get update
sudo apt-get install -y libze1 libze-dev sudo apt-get install -y libze1 libze-dev
- name: golangci-lint - name: golangci-lint
uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6 uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7
with: with:
version: v1.64.5 version: v2.0.2
args: -v --timeout 5m args: -v --timeout 5m
build: build:
name: Build and check device plugins name: Build and check device plugins

View File

@ -1,28 +1,25 @@
version: "2"
run: run:
tests: true
build-tags: build-tags:
- kerneldrv - kerneldrv
tests: true
linters: linters:
disable-all: true default: none
enable: enable:
- asciicheck - asciicheck
- bodyclose - bodyclose
- dogsled
- errcheck
- copyloopvar - copyloopvar
- dogsled
- err113
- errcheck
- gocognit - gocognit
- goconst - goconst
- gocyclo - gocyclo
- godot - godot
- err113
- gofmt
- goimports
- gomodguard - gomodguard
- gosimple - goprintffuncname
- gosec - gosec
- govet - govet
- goprintffuncname
- ineffassign - ineffassign
- misspell - misspell
- nakedret - nakedret
@ -31,46 +28,67 @@ linters:
- prealloc - prealloc
- revive - revive
- staticcheck - staticcheck
- stylecheck
- typecheck
- unconvert - unconvert
- unused - unused
- whitespace - whitespace
- wsl - wsl
settings:
linters-settings: gocognit:
min-complexity: 31
gocyclo:
min-complexity: 15
govet:
enable:
- fieldalignment
- shadow
revive: revive:
rules: rules:
- name: unused-parameter - name: unused-parameter
disabled: true disabled: true
gofmt: exclusions:
simplify: true generated: lax
goconst: presets:
ignore-tests: true - comments
govet: - common-false-positives
enable: - legacy
- "fieldalignment" - std-error-handling
- "shadow" rules:
gocyclo: - linters:
min-complexity: 15 - staticcheck
gocognit: text: QF100(1|4|8)
min-complexity: 31
issues:
exclude-rules:
- linters: - linters:
- gosec - gosec
text: "G115" text: G115
- path: _test\.go - linters:
linters:
- gocognit
- wsl
- gocyclo
- path: test/e2e/
linters:
- wsl
- gocognit - gocognit
- gocyclo - gocyclo
- path: cmd/gpu_fakedev/
linters:
- wsl - wsl
path: _test\.go
- linters:
- gocognit
- gocyclo
- wsl
path: test/e2e/
- linters:
- wsl
path: cmd/gpu_fakedev/
- linters:
- goconst
path: (.+)_test\.go
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
- goimports
settings:
gofmt:
simplify: true
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$

View File

@ -10,7 +10,7 @@ EXTRA_BUILD_ARGS ?= ""
CERT_MANAGER_VERSION ?= v1.15.2 CERT_MANAGER_VERSION ?= v1.15.2
CONTROLLER_GEN_VERSION ?= v0.17.0 CONTROLLER_GEN_VERSION ?= v0.17.0
GOLANGCI_LINT_VERSION ?= v1.64.5 GOLANGCI_LINT_VERSION ?= v2.0.2
KIND_VERSION ?= v0.23.0 KIND_VERSION ?= v0.23.0
GOLICENSES_VERSION ?= v1.6.0 GOLICENSES_VERSION ?= v1.6.0
# Default bundle image tag # Default bundle image tag
@ -44,7 +44,7 @@ vendor:
install-tools: install-tools:
GO111MODULE=on $(GO) install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_GEN_VERSION) GO111MODULE=on $(GO) install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_GEN_VERSION)
$(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) $(GO) install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
$(GO) install sigs.k8s.io/kind@${KIND_VERSION} $(GO) install sigs.k8s.io/kind@${KIND_VERSION}
go-mod-tidy: go-mod-tidy: