Skip to content

Commit d768020

Browse files
committed
Enable more Go linters and document exclusions
1 parent 5b7538a commit d768020

File tree

21 files changed

+198
-265
lines changed

21 files changed

+198
-265
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: 73 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,85 @@
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
50+
- nosprintfhostport
51+
- prealloc
2052
- predeclared
21-
- revive
22-
- staticcheck # exclude-use-default
23-
- tenv
24-
- thelper
25-
- tparallel
53+
- promlinter
54+
- protogetter
55+
- reassign
56+
- recvcheck
57+
- rowserrcheck
58+
- sloglint
59+
- spancheck
60+
- sqlclosecheck
61+
- tagalign
62+
- testifylint
63+
- unconvert
64+
- unparam
65+
- usestdlibvars
66+
- usetesting
2667
- wastedassign
27-
presets:
28-
- performance
68+
- wsl
69+
- zerologlint
2970

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'
71+
settings:
72+
thelper:
73+
# https://github.com/kulti/thelper/issues/27
74+
tb: { begin: true, first: true }
75+
test: { begin: true, first: true, name: true }
3676

37-
# https://github.com/golangci/golangci-lint/issues/2239
38-
exclude-use-default: false
39-
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 }
77+
exclusions:
78+
warn-unused: true
79+
# Ignore built-in exclusions
80+
presets: []
81+
rules:
82+
# We call external linters when they are installed: Flake8, ShellCheck, etc.
83+
- linters: [gosec]
84+
path: '_test[.]go$'
85+
text: 'G204: Subprocess launched with variable'

0 commit comments

Comments
 (0)