Skip to content

Commit 82909e9

Browse files
committed
Enable more Go linters and document exclusions
1 parent 4a792df commit 82909e9

File tree

21 files changed

+199
-250
lines changed

21 files changed

+199
-250
lines changed

.github/workflows/lint.yaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,8 @@ jobs:
2828
# exits zero to ensure it does not fail the pull request check.
2929
- name: Count non-blocking issues
3030
run: |
31-
golangci-lint run --config .golangci.next.yaml \
32-
--issues-exit-code 0 \
33-
--max-issues-per-linter 0 \
34-
--max-same-issues 0 \
35-
--out-format json |
36-
jq --sort-keys 'reduce .Issues[] as $i ({}; .[$i.FromLinter] += 1)' |
37-
awk >> "${GITHUB_STEP_SUMMARY}" '
38-
NR == 1 { print "```json" } { print } END { if (NR > 0) print "```" }
39-
' || true
31+
golangci-lint run --config .golangci.next.yaml --show-stats >> "${GITHUB_STEP_SUMMARY}" \
32+
--max-issues-per-linter=0 \
33+
--max-same-issues=0 \
34+
--uniq-by-line=0 \
35+
--output.text.path=/dev/null ||:

.golangci.bck.yaml

Lines changed: 0 additions & 122 deletions
This file was deleted.

.golangci.next.yaml

Lines changed: 86 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,98 @@
1-
# https://golangci-lint.run/usage/configuration/
1+
# https://golangci-lint.run/usage/configuration
22
#
33
# This file is for linters that might be interesting to enforce in the future.
44
# Rules that should be enforced immediately belong in [.golangci.yaml].
55
#
66
# Both files are used by [.github/workflows/lint.yaml].
7+
version: "2"
78

9+
# https://golangci-lint.run/usage/linters
810
linters:
9-
disable-all: true
10-
enable:
11-
- contextcheck
12-
- err113
13-
- gocritic
14-
- godot
15-
- godox
16-
- gofumpt
17-
- gosec # exclude-use-default
18-
- nilnil
11+
default: all
12+
disable:
13+
- asasalint
14+
- asciicheck
15+
- bidichk
16+
- bodyclose
17+
- copyloopvar
18+
- depguard
19+
- dupword
20+
- durationcheck
21+
- errchkjson
22+
- errname
23+
- errorlint
24+
- exhaustive
25+
- exptostd
26+
- fatcontext
27+
- forbidigo
28+
- ginkgolinter
29+
- gocheckcompilerdirectives
30+
- gochecksumtype
31+
- goheader
32+
- gomoddirectives
33+
- gomodguard
34+
- goprintffuncname
35+
- gosmopolitan
36+
- grouper
37+
- iface
38+
- importas
39+
- interfacebloat
40+
- intrange
41+
- loggercheck
42+
- makezero
43+
- mirror
44+
- misspell
45+
- musttag
46+
- nilerr
47+
- nilnesserr
48+
- noctx
1949
- nolintlint
20-
- predeclared
21-
- revive
22-
- staticcheck # exclude-use-default
23-
- tenv
24-
- thelper
25-
- tparallel
50+
- nosprintfhostport
51+
- prealloc
52+
- promlinter
53+
- protogetter
54+
- reassign
55+
- recvcheck
56+
- rowserrcheck
57+
- sloglint
58+
- spancheck
59+
- sqlclosecheck
60+
- tagalign
61+
- testifylint
62+
- unconvert
63+
- unparam
64+
- usestdlibvars
65+
- usetesting
2666
- wastedassign
27-
presets:
28-
- performance
67+
- wsl
68+
- zerologlint
2969

30-
issues:
31-
exclude-rules:
32-
# We call external linters when they are installed: Flake8, ShellCheck, etc.
33-
- linters: [gosec]
34-
path: '_test[.]go$'
35-
text: 'G204: Subprocess launched with variable'
70+
settings:
71+
thelper:
72+
# https://github.com/kulti/thelper/issues/27
73+
tb: { begin: true, first: true }
74+
test: { begin: true, first: true, name: true }
75+
76+
exclusions:
77+
warn-unused: true
78+
# Ignore built-in exclusions
79+
presets: []
80+
rules:
81+
# We call external linters when they are installed: Flake8, ShellCheck, etc.
82+
- linters: [gosec]
83+
path: '_test[.]go$'
84+
text: 'G204: Subprocess launched with variable'
3685

37-
# https://github.com/golangci/golangci-lint/issues/2239
38-
exclude-use-default: false
86+
# https://golangci-lint.run/usage/formatters
87+
formatters:
88+
enable:
89+
- gofumpt
90+
91+
issues:
92+
# Fix only when requested
93+
fix: false
3994

40-
linters-settings:
41-
thelper:
42-
# https://github.com/kulti/thelper/issues/27
43-
tb: { begin: true, first: true }
44-
test: { begin: true, first: true, name: true }
95+
# Show all issues at once
96+
max-issues-per-linter: 0
97+
max-same-issues: 0
98+
uniq-by-line: false

0 commit comments

Comments
 (0)