Skip to content

Commit cb8675e

Browse files
committed
Use golangci-lint 2.0.2
1 parent 11bfefa commit cb8675e

File tree

2 files changed

+62
-54
lines changed

2 files changed

+62
-54
lines changed

.golangci.yml

+61-53
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
run:
2-
timeout: 5m
1+
version: "2"
2+
output:
3+
formats:
4+
tab:
5+
path: stdout
6+
print-linter-name: true
7+
colors: false
38
linters:
49
enable:
510
- bodyclose
@@ -11,66 +16,69 @@ linters:
1116
- gochecknoinits
1217
- goconst
1318
- gocritic
14-
- gofmt
15-
- goimports
1619
- gosec
17-
- govet
1820
- lll
1921
- misspell
2022
- mnd
2123
- nakedret
2224
- noctx
2325
- nolintlint
24-
- stylecheck
26+
- staticcheck
2527
- unconvert
2628
- unparam
27-
linters-settings:
28-
goconst:
29-
# Exclude few word constants
30-
min-len: 20
31-
# Don't use goconst to check test files
32-
ignore-tests: true
29+
settings:
30+
goconst:
31+
min-len: 20
32+
exclusions:
33+
generated: lax
34+
presets:
35+
- comments
36+
- common-false-positives
37+
- legacy
38+
- std-error-handling
39+
rules:
40+
- linters:
41+
- mnd
42+
text: 'Magic number: [0-9]{1},'
43+
- linters:
44+
- mnd
45+
text: 'Magic number: 0[0-7]{3},'
46+
- linters:
47+
- mnd
48+
path: pkg/controllers/proxy/network_services_controller.go
49+
text: 'Magic number: 255,'
50+
- linters:
51+
- mnd
52+
text: 'Magic number: 32,'
53+
- linters:
54+
- mnd
55+
text: 'Magic number: 10,'
56+
- linters:
57+
- gosec
58+
text: 'G306:'
59+
- linters:
60+
- lll
61+
path: _test\.go
62+
- linters:
63+
- dupl
64+
path: _test\.go
65+
- linters:
66+
- goconst
67+
path: (.+)_test\.go
68+
paths:
69+
- third_party$
70+
- builtin$
71+
- examples$
3372
issues:
34-
exclude-rules:
35-
# Excluding single digits from magic number detector because it produces too many obvious results (like klog)
36-
- text: "Magic number: [0-9]{1},"
37-
linters:
38-
- mnd
39-
# Exclude file masks from magic number detector because these numbers are obvious
40-
- text: "Magic number: 0[0-7]{3},"
41-
linters:
42-
- mnd
43-
# Exlude IP masks netmasks as substituting them for constants only makes these less obvious
44-
- text: "Magic number: 255,"
45-
linters:
46-
- mnd
47-
path: pkg/controllers/proxy/network_services_controller.go
48-
# Exclude IP netmasks from magic number detector because these numbers are obvious
49-
- text: "Magic number: 32,"
50-
linters:
51-
- mnd
52-
# Exclude decimal bases from magic number detector because these numbers are obvious
53-
- text: "Magic number: 10,"
54-
linters:
55-
- mnd
56-
# Exclude file mask security findings as we are always intentional about the file masks we use
57-
- text: "G306:"
58-
linters:
59-
- gosec
60-
# Exclude tests from long line linter
61-
- linters:
62-
- lll
63-
path: _test\.go
64-
# Exclude tests from duplicate linter
65-
- linters:
66-
- dupl
67-
path: _test\.go
68-
# always show all issues rather than only showing 50 at a time
6973
max-issues-per-linter: 0
70-
# always show all issues of a type rather than showing 3
7174
max-same-issues: 0
72-
output:
73-
formats:
74-
- format: tab
75-
print-issued-lines: true
76-
print-linter-name: true
75+
formatters:
76+
enable:
77+
- gofmt
78+
- goimports
79+
exclusions:
80+
generated: lax
81+
paths:
82+
- third_party$
83+
- builtin$
84+
- examples$

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ GO_CACHE?=$(shell go env GOCACHE)
2424
GO_MOD_CACHE?=$(shell go env GOMODCACHE)
2525
BUILDTIME_BASE?=$(DOCKER_BUILD_IMAGE)
2626
RUNTIME_BASE?=alpine:3.21
27-
DOCKER_LINT_IMAGE?=golangci/golangci-lint:v1.63.4
27+
DOCKER_LINT_IMAGE?=golangci/golangci-lint:v2.0.2
2828
DOCKER_MARKDOWNLINT_IMAGE?=tmknom/markdownlint:0.39.0
2929
GOBGP_VERSION=v3.29.0
3030
QEMU_IMAGE?=multiarch/qemu-user-static

0 commit comments

Comments
 (0)