Skip to content

Commit 9688b5c

Browse files
appleboyclaude
andcommitted
chore(lint): overhaul golangci-lint config with stricter rules
- Replace linter set with more comprehensive selection including revive, depguard, and modernize - Add detailed settings for depguard, nolintlint, gocritic, revive, and staticcheck - Switch exclusion rules from path-based to rule-based filtering - Remove goimports formatter and enable gofumpt extra rules - Add run timeout and unlimited issue reporting Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent a8859ae commit 9688b5c

1 file changed

Lines changed: 85 additions & 20 deletions

File tree

.golangci.yml

Lines changed: 85 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,114 @@
11
version: "2"
2+
output:
3+
sort-order:
4+
- file
25
linters:
36
default: none
47
enable:
8+
- bidichk
59
- bodyclose
6-
- dogsled
7-
- dupl
10+
- depguard
811
- errcheck
9-
- exhaustive
10-
- goconst
12+
- forbidigo
13+
- gocheckcompilerdirectives
1114
- gocritic
12-
- gocyclo
13-
- goprintffuncname
14-
- gosec
1515
- govet
1616
- ineffassign
17-
- misspell
17+
- mirror
18+
- modernize
1819
- nakedret
19-
- noctx
20+
- nilnil
2021
- nolintlint
21-
- rowserrcheck
22+
- perfsprint
23+
- revive
2224
- staticcheck
25+
- testifylint
2326
- unconvert
2427
- unparam
2528
- unused
26-
- whitespace
29+
- usestdlibvars
30+
- usetesting
31+
- wastedassign
32+
settings:
33+
depguard:
34+
rules:
35+
main:
36+
deny:
37+
- pkg: io/ioutil
38+
desc: use os or io instead
39+
- pkg: golang.org/x/exp
40+
desc: it's experimental and unreliable
41+
- pkg: github.com/pkg/errors
42+
desc: use builtin errors package instead
43+
nolintlint:
44+
allow-unused: false
45+
require-explanation: true
46+
require-specific: true
47+
gocritic:
48+
enabled-checks:
49+
- equalFold
50+
disabled-checks: []
51+
revive:
52+
severity: error
53+
rules:
54+
- name: blank-imports
55+
- name: constant-logical-expr
56+
- name: context-as-argument
57+
- name: context-keys-type
58+
- name: dot-imports
59+
- name: empty-lines
60+
- name: error-return
61+
- name: error-strings
62+
- name: exported
63+
- name: identical-branches
64+
- name: if-return
65+
- name: increment-decrement
66+
- name: modifies-value-receiver
67+
- name: package-comments
68+
- name: redefines-builtin-id
69+
- name: superfluous-else
70+
- name: time-naming
71+
- name: unexported-return
72+
- name: var-declaration
73+
- name: var-naming
74+
disabled: true
75+
staticcheck:
76+
checks:
77+
- all
78+
testifylint: {}
79+
usetesting:
80+
os-temp-dir: true
81+
perfsprint:
82+
concat-loop: false
83+
govet:
84+
enable:
85+
- nilness
86+
- unusedwrite
2787
exclusions:
2888
generated: lax
2989
presets:
3090
- comments
3191
- common-false-positives
3292
- legacy
3393
- std-error-handling
34-
paths:
35-
- third_party$
36-
- builtin$
37-
- examples$
94+
rules:
95+
- linters:
96+
- errcheck
97+
- staticcheck
98+
- unparam
99+
path: _test\.go
100+
issues:
101+
max-issues-per-linter: 0
102+
max-same-issues: 0
38103
formatters:
39104
enable:
40105
- gofmt
41106
- gofumpt
42-
- goimports
43107
- golines
108+
settings:
109+
gofumpt:
110+
extra-rules: true
44111
exclusions:
45112
generated: lax
46-
paths:
47-
- third_party$
48-
- builtin$
49-
- examples$
113+
run:
114+
timeout: 10m

0 commit comments

Comments
 (0)