-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy path.golangci.yaml
102 lines (99 loc) · 2.45 KB
/
.golangci.yaml
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
issues:
# The default exclude list seems rather aggressive, opt-in when needed instead
exclude-use-default: false
exclude-rules:
# Duplicated errcheck checks
- linters: [gosec]
text: G104
# Duplicated errcheck checks
- linters: [staticcheck]
text: SA5001
# We don't require comments on everything
- linters: [golint]
text: should have( a package)? comment
# very long lines are ok if they're URLs
- linters: [lll]
source: https?://
# very long lines are ok if they're go:generate
- linters: [lll]
source: "^//go:generate "
# Ignore errcheck on deferred Close
- linters: [errcheck]
source: ^\s*defer .*\.Close(.*)$
# Ignore ineffective assignments to ctx
- linters: [ineffassign]
source: ^\s*ctx.*=.*$
- linters: [staticcheck]
source: ^\s*ctx.*=.*$
# Don't require package docs
- linters: [stylecheck]
text: ST1000
# Unparam is allowed in tests
- linters: [unparam]
path: _test\.go
linters:
disable-all: true
enable:
- bodyclose
- depguard
- errcheck
- errorlint
- goconst
- gocyclo
- gofmt
- goimports
- gosec
- gosimple
- govet
- ineffassign
- lll
- misspell
- nakedret
- staticcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- forbidigo
linters-settings:
govet:
check-shadowing: false
golint:
min-confidence: 0
gocyclo:
min-complexity: 15
maligned:
suggest-new: true
dupl:
# Don't detect small duplications, but if we're duplicating functions across
# packages, we should consider refactoring.
threshold: 100
depguard:
rules:
main:
files:
- '$all'
deny:
- pkg: "github.com/pkg/errors"
desc: "use Go 1.13 errors instead: https://blog.golang.org/go1.13-errors"
testing:
files: ['$test']
deny:
- pkg: "github.com/stretchr/testify/assert"
desc: "use github.com/stretchr/testify/require instead"
goconst:
min-len: 8
min-occurrences: 10
lll:
line-length: 180
forbidigo:
# Forbid the following identifiers (list of regexp).
# Default: ["^(fmt\\.Print(|f|ln)|print|println)$"]
forbid:
# Builtin function:
- ^print.*$
- p: ^fmt\.Print.*$
msg: Do not commit print statements.
- p: ^os\.Getenv
msg: Pull values through configuration rather than os.Getenv