-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.golangci.yml
169 lines (167 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:
modules-download-mode: readonly
linters:
# Disable all linters by default and only explicitly enable the ones below.
disable-all: true
enable:
- bidichk
- dupl
- dupword
- errcheck
- errname
- errorlint
- exhaustive
- exptostd
- gci
- ginkgolinter
# gofmt is used just for its rewrite capabilities. gofumpt and gci are used
# on top for stricter formatting and import sorting.
- gofmt
- gofumpt
- gosec
- gosimple
- govet
- iface
- misspell
- nilnesserr
- nolintlint
- predeclared
- recvcheck
- revive
- staticcheck
- stylecheck
- testpackage
- unused
- usestdlibvars
- usetesting
linters-settings:
exhaustive:
check:
- switch
- map
gofmt:
simplify: true
rewrite-rules:
- pattern: 'interface{}'
replacement: 'any'
- pattern: 'a[0:len(a)]'
replacement: 'a[:]'
- pattern: 'a[:len(a)]'
replacement: 'a[:]'
- pattern: 'a[0:]'
replacement: 'a[:]'
- pattern: 'a[0:b]'
replacement: 'a[:b]'
- pattern: 'a[b:len(a)]'
replacement: 'a[b:]'
- pattern: '(a)'
replacement: 'a'
govet:
enable:
- appends
- asmdecl
- assign
- atomic
- bools
- buildtag
- cgocall
- composites
- copylocks
- deepequalerrors
- defers
- directive
- errorsas
- framepointer
- httpresponse
- ifaceassert
- loopclosure
- lostcancel
- nilfunc
- printf
- reflectvaluecompare
- shadow
- shift
- sigchanyzer
- slog
- sortslice
- stdmethods
- stdversion
- stringintconv
- structtag
- testinggoroutine
- tests
- timeformat
- unmarshal
- unreachable
- unsafeptr
- unusedresult
- unusedwrite
- waitgroup
revive:
enable-all-rules: false
rules:
- name: atomic
- name: blank-imports
- name: bool-literal-in-expr
- name: call-to-gc
- name: comment-spacings
- name: confusing-naming
- name: confusing-results
- name: constant-logical-expr
- name: context-as-argument
- name: context-keys-type
- name: datarace
- name: deep-exit
- name: defer
- name: duplicated-imports
- name: early-return
arguments:
# Do not suggest refactorings that would increase variable scope
- preserveScope
- name: empty-block
- name: error-naming
- name: error-return
- name: error-strings
- name: errorf
- name: exported
- name: filename-format
- name: flag-parameter
- name: get-return
- name: identical-branches
- name: if-return
- name: import-alias-naming
arguments:
# Ensure aliases like "foobar" are allowed and that dot imports are
# let through (dot imports are caught by "stylecheck").
# However, ensure that aliases with underscores like "foo_bar" are
# disallowed.
- "^[a-z\\.][a-z0-9]{0,}$"
- name: import-shadowing
- name: increment-decrement
- name: indent-error-flow
arguments:
# Do not suggest refactorings that would increase variable scope
- "preserveScope"
- name: modifies-value-receiver
- name: package-comments
- name: range
- name: receiver-naming
- name: redefines-builtin-id
- name: redundant-import-alias
- name: string-of-int
- name: struct-tag
- name: superfluous-else
arguments:
# Do not suggest refactorings that would increase variable scope
- "preserveScope"
- name: time-equal
- name: unchecked-type-assertion
- name: unconditional-recursion
- name: unexported-return
- name: unnecessary-stmt
- name: unused-parameter
arguments:
- allowRegex: "^_"
- name: useless-break
- name: var-declaration
- name: var-naming