Skip to content

Commit 4693c2c

Browse files
committed
Update golangci-lint to version 2
Newer golangci-lint uses a new configuration format and cannot load the old format. To avoid complications this change migrates the existing linter configuration to version 2 format and updates the CI pipeline accordingly.
1 parent 6b26081 commit 4693c2c

File tree

2 files changed

+55
-51
lines changed

2 files changed

+55
-51
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,11 @@ jobs:
3535
make -C identifier vendor
3636
3737
- name: Lint
38-
uses: golangci/golangci-lint-action@v4
38+
uses: golangci/golangci-lint-action@v8
3939
with:
4040
version: latest
4141
args: --timeout=2m
42-
skip-pkg-cache: true
43-
skip-build-cache: true
42+
skip-cache: true
4443
only-new-issues: true
4544

4645
- name: Build

.golangci.yaml

Lines changed: 53 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,9 @@
1+
version: "2"
12
run:
23
modules-download-mode: vendor
34
issues-exit-code: 0
4-
5-
linters-settings:
6-
govet:
7-
settings:
8-
printf:
9-
funcs:
10-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
11-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
12-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
13-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
14-
gocyclo:
15-
min-complexity: 10
16-
maligned:
17-
suggest-new: true
18-
dupl:
19-
threshold: 100
20-
goconst:
21-
min-len: 2
22-
min-occurrences: 2
23-
misspell:
24-
locale: US
25-
lll:
26-
line-length: 200
27-
goimports:
28-
local-prefixes: github.com/libregraph/lico
29-
gocritic:
30-
enabled-tags:
31-
- performance
32-
- style
33-
- experimental
34-
revive:
35-
min-confidence: 0
36-
shadow:
37-
385
linters:
39-
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
40-
disable-all: true
6+
default: none
417
enable:
428
- bodyclose
439
- copyloopvar
@@ -48,27 +14,66 @@ linters:
4814
- goconst
4915
- gocritic
5016
- gocyclo
51-
- gofmt
52-
- goimports
5317
- gosec
54-
- gosimple
5518
- govet
5619
- ineffassign
5720
- lll
5821
- misspell
5922
- nakedret
6023
- revive
6124
- staticcheck
62-
- stylecheck
63-
- typecheck
6425
- unconvert
6526
- unparam
6627
- unused
67-
68-
# don't enable:
69-
# - depguard - until https://github.com/OpenPeeDeeP/depguard/issues/7 gets fixed
70-
# - maligned,prealloc
71-
# - gochecknoglobals
72-
28+
settings:
29+
dupl:
30+
threshold: 100
31+
goconst:
32+
min-len: 2
33+
min-occurrences: 2
34+
gocritic:
35+
enabled-tags:
36+
- performance
37+
- style
38+
- experimental
39+
gocyclo:
40+
min-complexity: 10
41+
govet:
42+
settings:
43+
printf:
44+
funcs:
45+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
46+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
47+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
48+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
49+
lll:
50+
line-length: 200
51+
misspell:
52+
locale: US
53+
exclusions:
54+
generated: lax
55+
presets:
56+
- comments
57+
- common-false-positives
58+
- legacy
59+
- std-error-handling
60+
paths:
61+
- third_party$
62+
- builtin$
63+
- examples$
7364
severity:
74-
default-severity: warning
65+
default: warning
66+
formatters:
67+
enable:
68+
- gofmt
69+
- goimports
70+
settings:
71+
goimports:
72+
local-prefixes:
73+
- github.com/libregraph/lico
74+
exclusions:
75+
generated: lax
76+
paths:
77+
- third_party$
78+
- builtin$
79+
- examples$

0 commit comments

Comments
 (0)