Skip to content

Commit ead4e4d

Browse files
committed
Fix GoLang CI
1 parent 33ff9fb commit ead4e4d

File tree

2 files changed

+91
-116
lines changed

2 files changed

+91
-116
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,4 @@ jobs:
3535
- name: golangci-lint
3636
uses: golangci/golangci-lint-action@v8
3737
with:
38-
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
39-
version: latest
40-
41-
# Optional: working directory, useful for monorepos
42-
# working-directory: somedir
43-
44-
# Optional: golangci-lint command line arguments.
45-
# args: --issues-exit-code=0
46-
47-
# Optional: show only new issues if it's a pull request. The default value is `false`.
48-
# only-new-issues: true
49-
50-
# Optional: if set to true then the action will use pre-installed Go.
51-
skip-go-installation: true
52-
53-
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
54-
# skip-pkg-cache: true
55-
56-
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
57-
# skip-build-cache: true
38+
version: latest

.golangci.yml

Lines changed: 90 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,14 @@
1-
linters-settings:
2-
depguard:
3-
list-type: blacklist
4-
packages:
5-
# logging is allowed only by logutils.Log, logrus
6-
# is allowed to use only in logutils package
7-
- github.com/sirupsen/logrus
8-
packages-with-error-message:
9-
- github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
10-
dupl:
11-
threshold: 100
12-
funlen:
13-
lines: 100
14-
statements: 50
15-
gci:
16-
local-prefixes: github.com/golangci/golangci-lint
17-
goconst:
18-
min-len: 2
19-
min-occurrences: 2
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-
gocyclo:
34-
min-complexity: 15
35-
goimports:
36-
local-prefixes: github.com/golangci/golangci-lint
37-
gomnd:
38-
settings:
39-
mnd:
40-
# don't include the "operation" and "assign"
41-
checks:
42-
- argument
43-
- case
44-
- condition
45-
- return
46-
govet:
47-
check-shadowing: true
48-
settings:
49-
printf:
50-
funcs:
51-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
52-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
53-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
54-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
55-
lll:
56-
line-length: 140
57-
maligned:
58-
suggest-new: true
59-
misspell:
60-
locale: US
61-
nolintlint:
62-
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space)
63-
allow-unused: false # report any unused nolint directives
64-
require-explanation: false # don't require an explanation for nolint directives
65-
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
1+
formatters:
2+
settings:
3+
gci:
4+
sections:
5+
- prefix(github.com/golangci/golangci-lint)
6+
goimports:
7+
local-prefixes:
8+
- github.com/golangci/golangci-lint
669

6710
linters:
68-
disable-all: true
11+
default: none
6912
enable:
7013
- asciicheck
7114
- bodyclose
@@ -117,36 +60,87 @@ linters:
11760
# - varcheck
11861
# - whitespace
11962
# - wsl
63+
exclusions:
64+
paths:
65+
- test/testdata_etc
66+
- internal/cache
67+
- internal/renameio
68+
- internal/robustio
69+
rules:
70+
- path: _test\.go
71+
linters:
72+
- gomnd
73+
- path: pkg/golinters/errcheck.go
74+
text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead"
75+
- path: pkg/commands/run.go
76+
text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead"
12077

121-
issues:
122-
# Excluding configuration per-path, per-linter, per-text and per-source
123-
exclude-rules:
124-
- path: _test\.go
125-
linters:
78+
# TODO must be removed after the release of the next version (v1.41.0)
79+
- path: pkg/commands/run.go
80+
linters:
12681
- gomnd
82+
# TODO must be removed after the release of the next version (v1.41.0)
83+
- path: pkg/golinters/nolintlint/nolintlint.go
84+
linters:
85+
- gomnd
86+
# TODO must be removed after the release of the next version (v1.41.0)
87+
- path: pkg/printers/tab.go
88+
linters:
89+
- gomnd
90+
settings:
91+
govet:
92+
enable:
93+
- shadow
94+
settings:
95+
printf:
96+
funcs:
97+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
98+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
99+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
100+
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
101+
lll:
102+
line-length: 140
103+
depguard:
104+
rules:
105+
main:
106+
list-mode: strict
107+
deny:
108+
- pkg: github.com/sirupsen/logrus
109+
desc: "logging is allowed only by logutils.Log"
110+
dupl:
111+
threshold: 100
112+
funlen:
113+
lines: 100
114+
statements: 50
115+
goconst:
116+
min-len: 2
117+
min-occurrences: 2
118+
gocritic:
119+
enabled-tags:
120+
- diagnostic
121+
- experimental
122+
- opinionated
123+
- performance
124+
- style
125+
disabled-checks:
126+
- dupImport # https://github.com/go-critic/go-critic/issues/845
127+
- ifElseChain
128+
- octalLiteral
129+
- whyNoLint
130+
- wrapperFunc
131+
gocyclo:
132+
min-complexity: 15
133+
misspell:
134+
locale: US
135+
mnd:
136+
checks:
137+
- argument
138+
- case
139+
- condition
140+
- return
141+
nolintlint:
142+
allow-unused: false # report any unused nolint directives
143+
require-explanation: false # don't require an explanation for nolint directives
144+
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
127145

128-
- path: pkg/golinters/errcheck.go
129-
text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead"
130-
- path: pkg/commands/run.go
131-
text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead"
132-
133-
# TODO must be removed after the release of the next version (v1.41.0)
134-
- path: pkg/commands/run.go
135-
linters:
136-
- gomnd
137-
# TODO must be removed after the release of the next version (v1.41.0)
138-
- path: pkg/golinters/nolintlint/nolintlint.go
139-
linters:
140-
- gomnd
141-
# TODO must be removed after the release of the next version (v1.41.0)
142-
- path: pkg/printers/tab.go
143-
linters:
144-
- gomnd
145-
146-
147-
run:
148-
skip-dirs:
149-
- test/testdata_etc
150-
- internal/cache
151-
- internal/renameio
152-
- internal/robustio
146+
version: "2"

0 commit comments

Comments
 (0)