-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
.golangci.yml
194 lines (186 loc) · 5.36 KB
/
.golangci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
run:
go: 1.23
timeout: 10m
linters-settings:
depguard:
rules:
use_modern_packages:
list-mode: lax
deny:
- pkg: "math/rand$"
desc: Please use math/rand/v2
errcheck:
exclude-functions:
- flag.Set
- (*flag.FlagSet).Parse
- (flag.Value).Set
- fmt.Fprint
- fmt.Fprintf
- io.WriteString(fmt.State)
- io.WriteString(net/http.ResponseWriter)
- (net.Listener).Close
- (net/http.ResponseWriter).Write
- (*os.File).Close
- os.Remove
- os.RemoveAll
- os.Rename
- (*github.com/spf13/cobra.Command).Help
- (*github.com/spf13/cobra.Command).MarkFlagRequired
- (*github.com/spf13/cobra.Command).MarkPersistentFlagRequired
- (*github.com/spf13/cobra.Command).MarkPersistentFlagFilename
- (*github.com/spf13/pflag.FlagSet).MarkDeprecated
- (*google.golang.org/grpc.ClientConn).Close
- (*google.golang.org/grpc.Server).Serve
- (*vitess.io/vitess/go/bytes2.Buffer).Write
- (*vitess.io/vitess/go/bytes2.Buffer).WriteByte
- (*vitess.io/vitess/go/bytes2.Buffer).WriteString
- (vitess.io/vitess/go/sqltypes.BinWriter).Write
- vitess.io/vitess/go/vt/orchestrator/external/golib/log.Errore
- vitess.io/vitess/go/vt/orchestrator/external/golib/log.Errorf
- vitess.io/vitess/go/vt/orchestrator/external/golib/log.Fatal
- vitess.io/vitess/go/vt/orchestrator/external/golib/log.Fatale
- vitess.io/vitess/go/vt/orchestrator/external/golib/log.Fatalf
- (*vitess.io/vitess/go/vt/vttest.LocalCluster).TearDown
goimports:
local-prefixes: vitess.io/vitess
govet:
disable: # not supported when using Generics in 1.18
- nilness
- unusedwrite
- loopclosure # fixed in go1.22
linters:
disable-all: true
enable:
# Defaults
- depguard
- errcheck
- govet
- ineffassign
- typecheck
- staticcheck
- gosimple
# Extras
- gofmt
- goimports
- bodyclose
# revive is a replacement for golint, but we do not run it in CI for now.
# This is only enabled as a post-commit hook
# - revive
issues:
exclude-rules:
- path: '^go/vt/proto/'
linters:
- errcheck
- goimports
### BEGIN: errcheck exclusion rules. Each rule should be considered
# a TODO for removal after adding error checks to that package/file/etc,
# except where otherwise noted.
- path: '^go/cmd/(vtcombo|vtgateclienttest|vtorc)/'
linters:
- errcheck
- path: '^go/mysql/'
linters:
- errcheck
- path: '^go/mysql/collations'
linters:
- revive
- path: '^go/pools/.*_test.go'
linters:
- errcheck
- path: '^go/sqltypes/'
linters:
- errcheck
- path: '^go/stats/statsd/'
linters:
- errcheck
- path: '^go/test/'
linters:
- errcheck
- path: '^go/vt/automation/'
linters:
- errcheck
- path: '^go/vt/mysqlctl/'
linters:
- errcheck
# (NB: @ajm188) Technically, the below `exclude-rules` for `go/vt/orchestrator/external` is
# redundant with this line, but we actually want to permanently ignore orchestrator's
# vendored code, so we are keeping the exclusion rules separate because this one
# should be temporary while the latter should be permanent.
- path: '^go/vt/orchestrator/'
linters:
- errcheck
# This subtree should be permanently excluded, as it's vendored code.
- path: '^go/vt/orchestrator/external/'
linters:
- errcheck
- path: '^go/vt/schemamanager/'
linters:
- errcheck
- path: '^go/vt/servenv/'
linters:
- errcheck
# This code is autogenerated and should be permanently excluded.
- path: '^go/vt/sqlparser/(ast_format|ast_format_fast).go'
linters:
- errcheck
- path: '^go/vt/sqlparser/goyacc'
linters:
- errcheck
- path: '^go/vt/throttler/.*_test.go'
linters:
- errcheck
- path: '^go/vt/topo/.*/*._test.go'
linters:
- errcheck
- path: '^go/vt/vtcombo/'
linters:
- errcheck
- path: '^go/vt/vtctl/[^/]*.go'
linters:
- errcheck
- path: '^go/vt/vtctl/grpcvtctlclient/'
linters:
- errcheck
- path: '^go/vt/vtctl/grpcvtctlserver/'
linters:
- errcheck
- path: '^go/vt/vtctld/(schema|.*_test).go'
linters:
- errcheck
- path: '^go/vt/vtexplain/'
linters:
- errcheck
- path: '^go/vt/vtgate/.*_test.go'
linters:
- errcheck
- path: '^go/vt/vtgr/'
linters:
- errcheck
- path: '^go/vt/vttablet/(customrule|filelogger|grpctmserver|onlineddl|sandboxconn|tabletserver)/'
linters:
- errcheck
- path: '^go/vt/vttablet/tabletmanager/vreplication'
linters:
- errcheck
- path: '^go/vt/vttablet/(.*endtoend.*|.*_test.go)'
linters:
- errcheck
- path: '^go/vt/vttest'
linters:
- errcheck
- path: '^go/vt/worker'
linters:
- errcheck
- path: '^go/vt/workflow'
linters:
- errcheck
- path: '^go/vt/wrangler'
linters:
- errcheck
- path: '^go/vt/zkctl'
linters:
- errcheck
### END: errcheck exclusion rules
# https://github.com/golangci/golangci/wiki/Configuration
service:
golangci-lint-version: 1.52.2 # use the fixed version to not introduce new linters unexpectedly