Skip to content

Commit e1b2492

Browse files
longsleeprhafer
authored andcommitted
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 bed07d0 commit e1b2492

File tree

2 files changed

+56
-51
lines changed

2 files changed

+56
-51
lines changed

.github/workflows/go.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ jobs:
2525
run: make vendor
2626

2727
- name: Lint
28-
uses: golangci/golangci-lint-action@v4
28+
uses: golangci/golangci-lint-action@v8
2929
with:
3030
version: latest
31-
skip-pkg-cache: true
32-
skip-build-cache: true
31+
args: --timeout=2m
32+
skip-cache: true
3333
only-new-issues: true
3434

3535
- 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-
check-shadowing: true
8-
settings:
9-
printf:
10-
funcs:
11-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
12-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
13-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
14-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
15-
gocyclo:
16-
min-complexity: 10
17-
maligned:
18-
suggest-new: true
19-
dupl:
20-
threshold: 100
21-
goconst:
22-
min-len: 2
23-
min-occurrences: 2
24-
misspell:
25-
locale: US
26-
lll:
27-
line-length: 140
28-
goimports:
29-
local-prefixes: github.com/libregraph/idm
30-
gocritic:
31-
enabled-tags:
32-
- performance
33-
- style
34-
- experimental
35-
revive:
36-
min-confidence: 0
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: 140
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/idm
74+
exclusions:
75+
generated: lax
76+
paths:
77+
- third_party$
78+
- builtin$
79+
- examples$

0 commit comments

Comments
 (0)