Skip to content

Commit 468c372

Browse files
committed
multiple bumps
* golangci_lint bump version 2 * controller-gen * go mod version 1.24 * adding more linters Signed-off-by: Sebastian Sch <sebassch@gmail.com>
1 parent 338ecb0 commit 468c372

File tree

55 files changed

+644
-573
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+644
-573
lines changed

.github/workflows/chart-push-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
version: latest
1818

1919
- name: Check out the repo
20-
uses: actions/checkout@v5
20+
uses: actions/checkout@v6
2121

2222
- name: update chart
2323
env:

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424

2525
steps:
2626
- name: Checkout
27-
uses: actions/checkout@v5
27+
uses: actions/checkout@v6
2828

2929
- name: Initialize CodeQL
3030
uses: github/codeql-action/init@v4

.github/workflows/image-push-master.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-24.04
1515
steps:
1616
- name: Check out the repo
17-
uses: actions/checkout@v5
17+
uses: actions/checkout@v6
1818

1919
# Add support for more platforms with QEMU (optional)
2020
# https://github.com/docker/setup-qemu-action
@@ -53,7 +53,7 @@ jobs:
5353
runs-on: ubuntu-24.04
5454
steps:
5555
- name: Check out the repo
56-
uses: actions/checkout@v5
56+
uses: actions/checkout@v6
5757

5858
# Add support for more platforms with QEMU (optional)
5959
# https://github.com/docker/setup-qemu-action
@@ -92,7 +92,7 @@ jobs:
9292
runs-on: ubuntu-24.04
9393
steps:
9494
- name: Check out the repo
95-
uses: actions/checkout@v5
95+
uses: actions/checkout@v6
9696

9797
# Add support for more platforms with QEMU (optional)
9898
# https://github.com/docker/setup-qemu-action

.github/workflows/image-push-release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-24.04
1414
steps:
1515
- name: Check out the repo
16-
uses: actions/checkout@v5
16+
uses: actions/checkout@v6
1717

1818
# Add support for more platforms with QEMU (optional)
1919
# https://github.com/docker/setup-qemu-action
@@ -53,7 +53,7 @@ jobs:
5353
runs-on: ubuntu-24.04
5454
steps:
5555
- name: Check out the repo
56-
uses: actions/checkout@v5
56+
uses: actions/checkout@v6
5757

5858
# Add support for more platforms with QEMU (optional)
5959
# https://github.com/docker/setup-qemu-action
@@ -93,7 +93,7 @@ jobs:
9393
runs-on: ubuntu-24.04
9494
steps:
9595
- name: Check out the repo
96-
uses: actions/checkout@v5
96+
uses: actions/checkout@v6
9797

9898
# Add support for more platforms with QEMU (optional)
9999
# https://github.com/docker/setup-qemu-action

.github/workflows/test.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
go-version: 1.23.x
2020

2121
- name: Check out code into the Go module directory
22-
uses: actions/checkout@v5
22+
uses: actions/checkout@v6
2323

2424
- name: fmt
2525
run: IS_CONTAINER=yes make fmt
@@ -38,7 +38,7 @@ jobs:
3838
go-version: 1.23.x
3939

4040
- name: Check out code into the Go module directory
41-
uses: actions/checkout@v5
41+
uses: actions/checkout@v6
4242

4343
- name: test pkg on kubernetes
4444
run: CLUSTER_TYPE=kubernetes make test-pkg
@@ -78,7 +78,7 @@ jobs:
7878
go-version: 1.23.x
7979

8080
- name: Check out code into the Go module directory
81-
uses: actions/checkout@v5
81+
uses: actions/checkout@v6
8282

8383
- name: check go modules are up to date
8484
run: make check-deps
@@ -88,7 +88,7 @@ jobs:
8888
runs-on: ubuntu-24.04
8989
steps:
9090
- name: Check out code
91-
uses: actions/checkout@v5
91+
uses: actions/checkout@v6
9292

9393
- name: check if the config/ folder is up to date
9494
run: make check-manifests
@@ -102,15 +102,15 @@ jobs:
102102
with:
103103
go-version: 1.23.x
104104
- name: Check out code into the Go module directory
105-
uses: actions/checkout@v5
105+
uses: actions/checkout@v6
106106
- name: run lint checks
107107
run: make lint
108108

109109
shellcheck:
110110
name: Shellcheck
111111
runs-on: ubuntu-24.04
112112
steps:
113-
- uses: actions/checkout@v5
113+
- uses: actions/checkout@v6
114114
- name: Run ShellCheck
115115
uses: ludeeus/action-shellcheck@master
116116
with:
@@ -127,7 +127,7 @@ jobs:
127127
go-version: 1.23.x
128128

129129
- name: Check out code into the Go module directory
130-
uses: actions/checkout@v5
130+
uses: actions/checkout@v6
131131

132132
- name: test pkg on kubernetes
133133
run: CLUSTER_TYPE=kubernetes make test-pkg
@@ -157,7 +157,7 @@ jobs:
157157
run: make merge-test-coverage
158158

159159
- name: Coveralls
160-
uses: coverallsapp/github-action@v2.3.6
160+
uses: coverallsapp/github-action@v2.3.7
161161
with:
162162
github-token: ${{ secrets.GITHUB_TOKEN }}
163163
path-to-lcov: lcov.out
@@ -174,7 +174,7 @@ jobs:
174174
TEST_REPORT_PATH: k8s-artifacts
175175
steps:
176176
- name: Check out code into the Go module directory
177-
uses: actions/checkout@v5
177+
uses: actions/checkout@v6
178178

179179
- name: Set up Go 1.23
180180
uses: actions/setup-go@v6
@@ -208,7 +208,7 @@ jobs:
208208
TEST_REPORT_PATH: ocp-artifacts
209209
steps:
210210
- name: Check out code into the Go module directory
211-
uses: actions/checkout@v5
211+
uses: actions/checkout@v6
212212

213213
- name: Set up Go 1.23
214214
uses: actions/setup-go@v6

.golangci.yml

Lines changed: 114 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,143 @@
1-
# Tested with golangci-lint ver. 1.37
1+
# Tested with golangci-lint ver. 2.x
2+
version: "2"
3+
24
run:
35
timeout: 10m
4-
linters-settings:
5-
depguard:
6-
rules:
7-
main:
8-
deny:
9-
- pkg: github.com/sirupsen/logrus
10-
desc: "logging is allowed only by logutils.Log"
11-
dupl:
12-
threshold: 100
13-
funlen:
14-
lines: 100
15-
statements: 50
16-
goconst:
17-
min-len: 2
18-
min-occurrences: 2
19-
ignore-tests: true
20-
gocritic:
21-
enabled-tags:
22-
- diagnostic
23-
- experimental
24-
- opinionated
25-
- performance
26-
- style
27-
disabled-checks:
28-
- dupImport # https://github.com/go-critic/go-critic/issues/845
29-
- ifElseChain
30-
- octalLiteral
31-
- whyNoLint
32-
- wrapperFunc
33-
- unnamedResult
34-
settings:
35-
hugeParam:
36-
sizeThreshold: 512
37-
rangeValCopy:
38-
sizeThreshold: 512
39-
gocyclo:
40-
min-complexity: 15
41-
goimports:
42-
local-prefixes: github.com/k8snetworkplumbingwg/sriov-network-operator
43-
gomnd:
44-
settings:
45-
mnd:
46-
# don't include the "operation" and "assign"
47-
checks: argument,case,condition,return
48-
lll:
49-
line-length: 140
50-
misspell:
51-
locale: US
52-
prealloc:
53-
# Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
54-
# True by default.
55-
simple: true
56-
range-loops: true # Report preallocation suggestions on range loops, true by default
57-
for-loops: false # Report preallocation suggestions on for loops, false by default
58-
stylecheck:
59-
dot-import-whitelist:
60-
- github.com/onsi/ginkgo/v2
61-
- github.com/onsi/gomega
62-
- github.com/onsi/gomega/gstruct
636

647
linters:
65-
# please, do not use `enable-all`: it's deprecated and will be removed soon.
66-
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
67-
disable-all: true
8+
default: none
689
enable:
10+
- asciicheck # checks for non-ASCII identifiers
11+
- bidichk # checks for dangerous unicode sequences (security)
6912
- bodyclose
7013
- copyloopvar
7114
- depguard
7215
- dogsled
7316
# TODO fix issues- dupl
7417
# TODO fix issues- errcheck
18+
- errname # checks error naming conventions
7519
- exhaustive
7620
# TODO fix issues- funlen
77-
#- gochecknoinits
21+
- gocheckcompilerdirectives # validates go compiler directives
22+
#- gochecknoinits
7823
- goconst
7924
# TODO fix issues- gocritic
8025
# TODO fix issues- gocyclo
81-
- gofmt
82-
- goimports
83-
# TODO fix issues- gomnd
26+
# gofmt and goimports are now formatters in v2, not linters
27+
# TODO fix issues- mnd (formerly gomnd)
8428
- goprintffuncname
8529
# TODO fix issues- gosec
86-
- gosimple
87-
#- govet
30+
# gosimple and stylecheck are now part of staticcheck in v2
31+
- staticcheck
32+
#- govet
8833
- ineffassign
34+
# TODO fix issues- intrange (2 issues - use integer ranges Go 1.22+)
8935
# TODO fix issues- lll
36+
- makezero # finds slice declarations with non-zero initial length
9037
- misspell
9138
# TODO fix issues- nakedret
39+
# TODO fix issues- nilerr (3 issues - returns nil when error is not nil)
40+
# TODO fix issues- noctx (4 issues - missing context.Context)
9241
# TODO fix issues- prealloc
93-
#- scopelint
94-
# TODO fix issues- staticcheck
95-
- stylecheck
96-
- typecheck
42+
- reassign # checks package variable reassignment
43+
#- scopelint
9744
- unconvert
9845
# TODO fix issues- unparam
9946
- unused
10047
- whitespace
10148

102-
issues:
103-
exclude-dirs:
104-
- vendor/
105-
- .github/
106-
- deployment/
107-
- doc/
108-
- bindata/
109-
- pkg/client
110-
exclude-rules:
111-
- path: _test\.go
112-
linters:
113-
- gomnd
114-
- gosec
115-
- dupl
116-
- lll
117-
- stylecheck
118-
- goconst
119-
- path: test/conformance/tests
120-
linters:
121-
- goconst
49+
settings:
50+
depguard:
51+
rules:
52+
main:
53+
deny:
54+
- pkg: github.com/sirupsen/logrus
55+
desc: "logging is allowed only by logutils.Log"
56+
dupl:
57+
threshold: 100
58+
funlen:
59+
lines: 100
60+
statements: 50
61+
goconst:
62+
min-len: 2
63+
min-occurrences: 2
64+
gocritic:
65+
enabled-tags:
66+
- diagnostic
67+
- experimental
68+
- opinionated
69+
- performance
70+
- style
71+
disabled-checks:
72+
- ifElseChain # style preference - suggests switch over if-else
73+
- whyNoLint # requires explanation for nolint directives
74+
- unnamedResult # style preference - named return values
75+
settings:
76+
hugeParam:
77+
sizeThreshold: 512
78+
rangeValCopy:
79+
sizeThreshold: 512
80+
gocyclo:
81+
min-complexity: 15
82+
mnd:
83+
# don't include the "operation" and "assign"
84+
checks:
85+
- argument
86+
- case
87+
- condition
88+
- return
89+
lll:
90+
line-length: 140
91+
misspell:
92+
locale: US
93+
prealloc:
94+
# Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
95+
# True by default.
96+
simple: true
97+
range-loops: true # Report preallocation suggestions on range loops, true by default
98+
for-loops: false # Report preallocation suggestions on for loops, false by default
99+
staticcheck:
100+
checks:
101+
- all
102+
- -QF1001 # De Morgan's law suggestions
103+
- -QF1003 # tagged switch suggestions
104+
- -QF1008 # embedded field selector suggestions
105+
dot-import-whitelist:
106+
- github.com/onsi/ginkgo/v2
107+
- github.com/onsi/gomega
108+
- github.com/onsi/gomega/gstruct
122109

110+
exclusions:
111+
generated: lax
112+
presets:
113+
- comments
114+
- std-error-handling
115+
paths:
116+
- vendor/
117+
- .github/
118+
- deployment/
119+
- doc/
120+
- bindata/
121+
- pkg/client
122+
rules:
123+
# Exclude various linters from test files
124+
- path: _test\.go
125+
linters:
126+
- mnd
127+
- gosec
128+
- dupl
129+
- lll
130+
- goconst
131+
# Exclude linters from test/ directory
132+
- path: ^test/
133+
linters:
134+
- goconst
135+
136+
formatters:
137+
enable:
138+
- gofmt
139+
- goimports
140+
settings:
141+
goimports:
142+
local-prefixes:
143+
- github.com/k8snetworkplumbingwg/sriov-network-operator

0 commit comments

Comments
 (0)