-
-
Notifications
You must be signed in to change notification settings - Fork 524
/
.golangci.yml
169 lines (162 loc) · 4.03 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
run:
build-tags:
- citest
modules-download-mode: readonly
issues:
# Give me the full output
max-same-issues: 0
# Use the default excludes...
exclude-use-default: false
# ...but also add some of our own
exclude:
- Error return value of `(\w+\.)+(Close|CloseSend|Flush|Remove|(Un)?Setenv|(Fp|P)rint(f|ln))\` is not checked
- 'structtag: struct field \w+ repeats json tag'
- 'Subprocess launched with function call as argument or cmd arguments'
exclude-rules:
- path: _test\.go
linters:
- const
- dupl
- gochecknoglobals
- goconst
- golint
- lll
- unparam
linters-settings:
cyclop:
max-complexity: 32
skip-tests: true
depguard:
rules:
main:
files:
- $all
deny:
- pkg: io/ioutil
desc: "`io/ioutil` is deprecated in Go 1.16, use `io` or `os` instead"
- pkg: syscall
desc: "Use `golang.org/x/sys/...` instead of `syscall`"
- pkg: github.com/golang/protobuf
desc: "Use `google.golang.org/protobuf` instead of `github.com/golang/protobuf`"
- pkg: github.com/kballard/go-shellquote
desc: "Use `github.com/telepresenceio/telepresence/pkg/shellquote.ShellString` instead of `github.com/kballard/go-shellquote.Join`"
- pkg: github.com/datawire/dlib/dutil
desc: "Use either `github.com/datawire/dlib/derror` or `github.com/datawire/dlib/dhttp` instead of `github.com/datawire/dlib/dutil`"
- pkg: golang.org/x/net/http2/h2c
desc: "Use `github.com/datawire/dlib/dhttp` instead of `golang.org/x/net/http2/h2c`"
gomodguard:
blocked:
modules:
- gotest.tools: { recommendations: ['github.com/stretchr/testify', 'github.com/google/go-cmp/cmp'] }
- gotest.tools/v2: { recommendations: ['github.com/stretchr/testify', 'github.com/google/go-cmp/cmp'] }
- gotest.tools/v3: { recommendations: ['github.com/stretchr/testify', 'github.com/google/go-cmp/cmp'] }
forbidigo:
forbid:
- '^os\.(DirEntry|FileInfo|FileMode|PathError)$' # deprecated in Go 1.16, import them from 'io/fs' instead
- '\.Readdir$' # deprecated in Go 1.16, use ReadDir instead
exclude_godoc_examples: false
gocyclo:
min-complexity: 35
gocognit:
min-complexity: 60
lll:
line-length: 180
tab-width: 2
nolintlint:
allow-unused: true # Needed because there's some linters disabled for 1.18
allow-leading-space: false
require-explanation: true
require-specific: true
allow-no-explanation:
- gocognit
linters:
# Enable specific linter
# https://golangci-lint.run/usage/linters/#enabled-by-default
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- copyloopvar
- cyclop
- decorder
- depguard
- dogsled
- durationcheck
- errcheck
- errname
- forbidigo
- gochecknoglobals
- gocognit
- gocritic
- gocyclo
- godot
- gofmt
- gofumpt
- goheader
- gomodguard
- goprintffuncname
- gosimple
- govet
- grouper
- importas
- ineffassign
- lll
- loggercheck
- makezero
- misspell
- nakedret
- nolintlint
- nosprintfhostport
- prealloc
- predeclared
- reassign
- staticcheck
- unconvert
- unparam
- unused
- usestdlibvars
- whitespace
disable:
- containedctx
- contextcheck
- dupl
- errchkjson
- errorlint
- exhaustive
- exhaustruct
- forcetypeassert
- funlen
- gci
- gochecknoinits
- goconst
- err113
- godox
- goimports
- gomoddirectives
- gosec
- interfacebloat
- ireturn
- maintidx
- nestif
- nilerr
- nilnil
- nlreturn
- noctx
- nonamedreturns
- paralleltest
- promlinter
- revive
- rowserrcheck
- sqlclosecheck
- stylecheck
- tagliatelle
- tenv
- testpackage
- thelper
- tparallel
- typecheck
- varnamelen
- wastedassign
- wrapcheck
- wsl