-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy path.golangci.yml
More file actions
51 lines (45 loc) · 1.88 KB
/
Copy path.golangci.yml
File metadata and controls
51 lines (45 loc) · 1.88 KB
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
# golangci-lint policy.
#
# The linter must be built with the same Go toolchain that compiles the module.
# A binary built with an older Go cannot read the current stdlib's export data,
# and what that looks like is not an honest error but a cascade of nonsense: with
# io, net/url and cmp unloadable, every method promoted from an embedded stdlib
# type is reported "undefined", so valid code fails typecheck in five places and
# every other linter is suppressed behind it. Install with:
#
# go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
#
# which compiles it against the local toolchain and keeps the two in step.
version: "2"
linters:
settings:
errcheck:
# Writes into a buffer, a tabwriter or stdout. The error is either
# unreachable - an in-memory sink cannot fail - or reported again by the
# Flush or Close that follows, and those are checked. Requiring it here
# would put "_ =" on every line of every report and bury the one place
# the answer is worth reading.
exclude-functions:
- fmt.Fprint
- fmt.Fprintf
- fmt.Fprintln
- io.WriteString
exclusions:
rules:
# extra/ holds one-off tools - a crawl helper, a 0.4.1 cache converter, a
# URL checker. They are not part of the binary and are kept as written.
- path: ^extra/
linters: [errcheck, govet, staticcheck, unused]
# A test that fails to close something fails on the assertion it was
# making, and the cleanup is usually a t.Cleanup away from the call.
- path: _test\.go$
linters: [errcheck]
issues:
# Report every occurrence. The defaults cap identical messages at three, which
# for a rule like errcheck means fixing three and being handed three more -
# the count is never the truth until it is zero.
max-issues-per-linter: 0
max-same-issues: 0
formatters:
enable:
- gofmt