1
1
# https://golangci-lint.run/usage/configuration/
2
+ version : " 2"
2
3
run :
3
- timeout : 10m
4
-
5
4
# If set we pass it to "go list -mod={option}". From "go help modules":
6
5
# If invoked with -mod=readonly, the go command is disallowed from the implicit
7
6
# automatic updating of go.mod described above. Instead, it fails when any changes
22
21
23
22
issues :
24
23
# Make issues output unique by line.
25
- # Default: true
26
24
uniq-by-line : false
27
25
28
26
# Maximum issues count per one linter.
29
- # Set to 0 to disable.
30
- # Default: 50
31
27
max-issues-per-linter : 0
32
28
33
29
# Maximum count of issues with the same text.
34
- # Set to 0 to disable.
35
- # Default: 3
36
30
max-same-issues : 0
37
31
38
- # Enables skipping of directories:
39
- # - vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
40
- # Default: true
41
- exclude-dirs-use-default : false
42
-
43
32
linters :
44
- disable-all : true
33
+ default : none
45
34
enable :
46
35
- asciicheck
47
36
- bodyclose
@@ -51,20 +40,13 @@ linters:
51
40
- errcheck
52
41
- errorlint
53
42
- forbidigo
54
- - gci
55
43
- goconst
56
44
- gocritic
57
- # - goerr113
58
- - gofmt
59
- - gofumpt
60
- # - gomnd
61
45
- goprintffuncname
62
46
- gosec
63
- - gosimple
64
47
- govet
65
48
- importas
66
49
- ineffassign
67
- # - lll
68
50
- misspell
69
51
- nakedret
70
52
- nilerr
@@ -76,133 +58,135 @@ linters:
76
58
- revive
77
59
- spancheck
78
60
- staticcheck
79
- - stylecheck
80
61
- tagalign
81
62
- testifylint
82
- - typecheck
83
63
- unconvert
84
64
- unparam
85
65
- unused
86
66
- usestdlibvars
87
67
- whitespace
88
-
89
- linters-settings :
90
- depguard :
91
- rules :
92
- packages :
93
- deny :
94
- - pkg : " container/list"
95
- desc : github.com/ava-labs/avalanchego/utils/linked should be used instead.
96
- - pkg : " github.com/golang/mock/gomock"
97
- desc : go.uber.org/mock/gomock should be used instead.
98
- - pkg : " github.com/stretchr/testify/assert"
99
- desc : github.com/stretchr/testify/require should be used instead.
100
- - pkg : " io/ioutil"
101
- desc : io/ioutil is deprecated. Use package io or os instead.
102
- errorlint :
103
- # Check for plain type assertions and type switches.
104
- asserts : false
105
- # Check for plain error comparisons.
106
- comparison : false
107
- forbidigo :
108
- # Forbid the following identifiers (list of regexp).
109
- forbid :
110
- - ' require\.Error$(# ErrorIs should be used instead)?'
111
- - ' require\.ErrorContains$(# ErrorIs should be used instead)?'
112
- - ' require\.EqualValues$(# Equal should be used instead)?'
113
- - ' require\.NotEqualValues$(# NotEqual should be used instead)?'
114
- - ' ^(t|b|tb|f)\.(Fatal|Fatalf|Error|Errorf)$(# the require library should be used instead)?'
115
- - ' ^sort\.(Slice|Strings)$(# the slices package should be used instead)?'
116
- # Exclude godoc examples from forbidigo checks.
117
- exclude_godoc_examples : false
118
- gci :
119
- sections :
120
- - standard
121
- - default
122
- - blank
123
- - prefix(github.com/ava-labs/avalanchego)
124
- - alias
125
- - dot
126
- skip-generated : true
127
- custom-order : true
128
- gosec :
129
- excludes :
130
- - G107 # Url provided to HTTP request as taint input https://securego.io/docs/rules/g107
131
- - G115 # TODO(marun) Enable this ruleset in a follow-up PR
132
- importas :
133
- # Do not allow unaliased imports of aliased packages.
134
- no-unaliased : false
135
- # Do not allow non-required aliases.
136
- no-extra-aliases : false
137
- # List of aliases
138
- alias :
139
- - pkg : github.com/ava-labs/avalanchego/utils/math
140
- alias : safemath
141
- - pkg : github.com/ava-labs/avalanchego/utils/json
142
- alias : avajson
143
- revive :
144
- rules :
145
- # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bool-literal-in-expr
146
- - name : bool-literal-in-expr
147
- disabled : false
148
- # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#early-return
149
- - name : early-return
150
- disabled : false
151
- # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-lines
152
- - name : empty-lines
153
- disabled : false
154
- # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#string-format
155
- - name : string-format
156
- disabled : false
157
- arguments :
158
- - ["b.Logf[0]", "/.*%.*/", "no format directive, use b.Log instead"]
159
- - ["fmt.Errorf[0]", "/.*%.*/", "no format directive, use errors.New instead"]
160
- - ["fmt.Fprintf[1]", "/.*%.*/", "no format directive, use fmt.Fprint instead"]
161
- - ["fmt.Printf[0]", "/.*%.*/", "no format directive, use fmt.Print instead"]
162
- - ["fmt.Sprintf[0]", "/.*%.*/", "no format directive, use fmt.Sprint instead"]
163
- - ["log.Fatalf[0]", "/.*%.*/", "no format directive, use log.Fatal instead"]
164
- - ["log.Printf[0]", "/.*%.*/", "no format directive, use log.Print instead"]
165
- - ["t.Logf[0]", "/.*%.*/", "no format directive, use t.Log instead"]
166
- # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#struct-tag
167
- - name : struct-tag
168
- disabled : false
169
- # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unexported-naming
170
- - name : unexported-naming
171
- disabled : false
172
- # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unhandled-error
173
- - name : unhandled-error
174
- # prefer the errcheck linter since it can be disabled directly with nolint directive
175
- # but revive's disable directive (e.g. //revive:disable:unhandled-error) is not
176
- # supported when run under golangci_lint
177
- disabled : true
178
- # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter
179
- - name : unused-parameter
180
- disabled : false
181
- # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-receiver
182
- - name : unused-receiver
183
- disabled : false
184
- # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#useless-break
185
- - name : useless-break
186
- disabled : false
187
- spancheck :
188
- # https://github.com/jjti/go-spancheck#checks
189
- checks :
190
- - end
191
- # - record-error # check that `span.RecordError(err)` is called when an error is returned
192
- # - set-status # check that `span.SetStatus(codes.Error, msg)` is called when an error is returned
193
- staticcheck :
194
- # https://staticcheck.io/docs/options#checks
195
- checks :
196
- - " all"
197
- - " -SA6002" # Storing non-pointer values in sync.Pool allocates memory
198
- - " -SA1019" # Using a deprecated function, variable, constant or field
199
- tagalign :
200
- align : true
201
- sort : true
202
- strict : true
203
- order :
204
- - serialize
205
- testifylint :
68
+ settings :
69
+ depguard :
70
+ rules :
71
+ packages :
72
+ deny :
73
+ - pkg : container/list
74
+ desc : github.com/ava-labs/avalanchego/utils/linked should be used instead.
75
+ - pkg : github.com/golang/mock/gomock
76
+ desc : go.uber.org/mock/gomock should be used instead.
77
+ - pkg : github.com/stretchr/testify/assert
78
+ desc : github.com/stretchr/testify/require should be used instead.
79
+ - pkg : io/ioutil
80
+ desc : io/ioutil is deprecated. Use package io or os instead.
81
+ errorlint :
82
+ # Check for plain type assertions and type switches.
83
+ asserts : false
84
+ # Check for plain error comparisons.
85
+ comparison : false
86
+ forbidigo :
87
+ # Forbid the following identifiers (list of regexp).
88
+ forbid :
89
+ - pattern : require\.Error$(# ErrorIs should be used instead)?
90
+ - pattern : require\.ErrorContains$(# ErrorIs should be used instead)?
91
+ - pattern : require\.EqualValues$(# Equal should be used instead)?
92
+ - pattern : require\.NotEqualValues$(# NotEqual should be used instead)?
93
+ - pattern : ^(t|b|tb|f)\.(Fatal|Fatalf|Error|Errorf)$(# the require library should be used instead)?
94
+ - pattern : ^sort\.(Slice|Strings)$(# the slices package should be used instead)?
95
+ # Exclude godoc examples from forbidigo checks.
96
+ exclude-godoc-examples : false
97
+ gosec :
98
+ excludes :
99
+ - G107 # Url provided to HTTP request as taint input https://securego.io/docs/rules/g107
100
+ - G115 # TODO(marun) Enable this ruleset in a follow-up PR
101
+ importas :
102
+ # Do not allow unaliased imports of aliased packages.
103
+ no-unaliased : false
104
+ # Do not allow non-required aliases.
105
+ no-extra-aliases : false
106
+ # List of aliases
107
+ alias :
108
+ - pkg : github.com/ava-labs/avalanchego/utils/math
109
+ alias : safemath
110
+ - pkg : github.com/ava-labs/avalanchego/utils/json
111
+ alias : avajson
112
+ revive :
113
+ rules :
114
+ # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bool-literal-in-expr
115
+ - name : bool-literal-in-expr
116
+ disabled : false
117
+ # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#early-return
118
+ - name : early-return
119
+ disabled : false
120
+ # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-lines
121
+ - name : empty-lines
122
+ disabled : false
123
+ # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#string-format
124
+ - name : string-format
125
+ disabled : false
126
+ arguments :
127
+ - - b.Logf[0]
128
+ - /.*%.*/
129
+ - no format directive, use b.Log instead
130
+ - - fmt.Errorf[0]
131
+ - /.*%.*/
132
+ - no format directive, use errors.New instead
133
+ - - fmt.Fprintf[1]
134
+ - /.*%.*/
135
+ - no format directive, use fmt.Fprint instead
136
+ - - fmt.Printf[0]
137
+ - /.*%.*/
138
+ - no format directive, use fmt.Print instead
139
+ - - fmt.Sprintf[0]
140
+ - /.*%.*/
141
+ - no format directive, use fmt.Sprint instead
142
+ - - log.Fatalf[0]
143
+ - /.*%.*/
144
+ - no format directive, use log.Fatal instead
145
+ - - log.Printf[0]
146
+ - /.*%.*/
147
+ - no format directive, use log.Print instead
148
+ - - t.Logf[0]
149
+ - /.*%.*/
150
+ - no format directive, use t.Log instead
151
+ # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#struct-tag
152
+ - name : struct-tag
153
+ disabled : false
154
+ # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unexported-naming
155
+ - name : unexported-naming
156
+ disabled : false
157
+ # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unhandled-error
158
+ - name : unhandled-error
159
+ # prefer the errcheck linter since it can be disabled directly with nolint directive
160
+ # but revive's disable directive (e.g. //revive:disable:unhandled-error) is not
161
+ # supported when run under golangci_lint
162
+ disabled : true
163
+ # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter
164
+ - name : unused-parameter
165
+ disabled : false
166
+ # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-receiver
167
+ - name : unused-receiver
168
+ disabled : false
169
+ # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#useless-break
170
+ - name : useless-break
171
+ disabled : false
172
+ spancheck :
173
+ # https://github.com/jjti/go-spancheck#checks
174
+ checks :
175
+ - end
176
+ staticcheck :
177
+ # https://staticcheck.io/docs/options#checks
178
+ checks :
179
+ - all
180
+ - -SA6002A # Storing non-pointer values in sync.Pool allocates memory
181
+ - -SA1019 # Using a deprecated function, variable, constant or field
182
+ - -QF1008 # Unnecessary embedded expressions
183
+ tagalign :
184
+ align : true
185
+ sort : true
186
+ order :
187
+ - serialize
188
+ strict : true
189
+ testifylint :
206
190
# Enable all checkers (https://github.com/Antonboom/testifylint#checkers).
207
191
# Default: false
208
192
enable-all : true
@@ -213,13 +197,37 @@ linters-settings:
213
197
disable :
214
198
- go-require
215
199
- float-compare
216
- unused :
217
- # Mark all struct fields that have been written to as used.
218
- # Default: true
219
- field-writes-are-uses : false
220
- # Treat IncDec statement (e.g. `i++` or `i--`) as both read and write operation instead of just write.
221
- # Default: false
222
- post-statements-are-reads : true
223
- # Mark all local variables as used.
224
- # default: true
225
- local-variables-are-used : false
200
+ unused :
201
+ # Mark all struct fields that have been written to as used.
202
+ # Default: true
203
+ field-writes-are-uses : false
204
+ # Treat IncDec statement (e.g. `i++` or `i--`) as both read and write operation instead of just write.
205
+ # Default: false
206
+ post-statements-are-reads : true
207
+ # Mark all local variables as used.
208
+ # default: true
209
+ local-variables-are-used : false
210
+ exclusions :
211
+ generated : lax
212
+ presets :
213
+ - comments
214
+ - common-false-positives
215
+ - legacy
216
+ - std-error-handling
217
+ formatters :
218
+ enable :
219
+ - gci
220
+ - gofmt
221
+ - gofumpt
222
+ settings :
223
+ gci :
224
+ sections :
225
+ - standard
226
+ - default
227
+ - blank
228
+ - prefix(github.com/ava-labs/avalanchego)
229
+ - alias
230
+ - dot
231
+ custom-order : true
232
+ exclusions :
233
+ generated : lax
0 commit comments