47
47
- " .*\\ .my\\ .go$"
48
48
- lib/bad.go
49
49
50
- # By default, it isn't set.
51
50
# If set we pass it to "go list -mod={option}". From "go help modules":
52
51
# If invoked with -mod=readonly, the go command is disallowed from the implicit
53
52
# automatic updating of go.mod described above. Instead, it fails when any changes
56
55
# If invoked with -mod=vendor, the go command assumes that the vendor
57
56
# directory holds the correct copies of dependencies and ignores
58
57
# the dependency descriptions in go.mod.
59
- modules-download-mode : readonly|vendor|mod
58
+ #
59
+ # Allowed values: readonly|vendor|mod
60
+ # By default, it isn't set.
61
+ modules-download-mode : readonly
60
62
61
63
# Allow multiple parallel golangci-lint instances running.
62
64
# If false (default) - golangci-lint acquires file lock on start.
@@ -143,13 +145,26 @@ linters-settings:
143
145
disable-dec-num-check : false
144
146
145
147
depguard :
146
- list-type : denylist
147
- include-go-root : false
148
+ # Kind of list is passed in.
149
+ # Allowed values: allowlist|denylist
150
+ # Default: denylist
151
+ list-type : allowlist
152
+
153
+ # Check the list against standard lib.
154
+ # Default: false
155
+ include-go-root : true
156
+
157
+ # A list of packages for the list type specified.
158
+ # Default: []
148
159
packages :
149
160
- github.com/sirupsen/logrus
161
+
162
+ # A list of packages for the list type specified.
163
+ # Specify an error message to output when a denied package is used.
164
+ # Default: []
150
165
packages-with-error-message :
151
- # Specify an error message to output when a denied package is used.
152
166
- github.com/sirupsen/logrus : ' logging is allowed only by logutils.Log'
167
+
153
168
# Create additional guards that follow the same configuration pattern.
154
169
# Results from all guards are aggregated together.
155
170
additional-guards :
@@ -226,23 +241,30 @@ linters-settings:
226
241
errorlint :
227
242
# Check whether fmt.Errorf uses the %w verb for formatting errors.
228
243
# See the https://github.com/polyfloyd/go-errorlint for caveats.
229
- errorf : true
244
+ # Default: true
245
+ errorf : false
230
246
# Check for plain type assertions and type switches.
231
- asserts : true
247
+ # Default: true
248
+ asserts : false
232
249
# Check for plain error comparisons.
233
- comparison : true
250
+ # Default: true
251
+ comparison : false
234
252
235
253
exhaustive :
236
254
# Check switch statements in generated files also.
237
- check-generated : false
255
+ # Default: false
256
+ check-generated : true
238
257
# Presence of "default" case in switch statements satisfies exhaustiveness,
239
258
# even if all enum members are not listed.
240
- default-signifies-exhaustive : false
259
+ # Default: false
260
+ default-signifies-exhaustive : true
241
261
# Enum members matching the supplied regex do not have to be listed in
242
262
# switch statements to satisfy exhaustiveness.
243
- ignore-enum-members : " "
263
+ # Default: ""
264
+ ignore-enum-members : " Example.+"
244
265
# Consider enums only in package scopes, not in inner scopes.
245
- package-scope-only : false
266
+ # Default: false
267
+ package-scope-only : true
246
268
247
269
exhaustivestruct :
248
270
# Struct Patterns is list of expressions to match struct packages and names.
@@ -263,8 +285,14 @@ linters-settings:
263
285
exclude_godoc_examples : false
264
286
265
287
funlen :
266
- lines : 60
267
- statements : 40
288
+ # Checks the number of lines in a function.
289
+ # If lower than 0, disable the check.
290
+ # Default: 60
291
+ lines : -1
292
+ # Checks the number of statements in a function.
293
+ # If lower than 0, disable the check.
294
+ # Default: 40
295
+ statements : -1
268
296
269
297
gci :
270
298
# Put imports beginning with prefix after 3rd-party packages.
@@ -274,7 +302,7 @@ linters-settings:
274
302
275
303
gocognit :
276
304
# Minimal code complexity to report
277
- # Default: 30, (but we recommend 10-20)
305
+ # Default: 30 (but we recommend 10-20)
278
306
min-complexity : 10
279
307
280
308
goconst :
@@ -323,9 +351,17 @@ linters-settings:
323
351
# See https://github.com/go-critic/go-critic#usage -> section "Tags".
324
352
# Default: []
325
353
enabled-tags :
354
+ - diagnostic
355
+ - style
326
356
- performance
357
+ - experimental
358
+ - opinionated
327
359
disabled-tags :
360
+ - diagnostic
361
+ - style
362
+ - performance
328
363
- experimental
364
+ - opinionated
329
365
330
366
# Settings passed to gocritic.
331
367
# The settings key is the name of a supported gocritic checker.
@@ -408,7 +444,7 @@ linters-settings:
408
444
409
445
gocyclo :
410
446
# Minimal code complexity to report.
411
- # Default: 30, (but we recommend 10-20)
447
+ # Default: 30 (but we recommend 10-20)
412
448
min-complexity : 10
413
449
414
450
godot :
@@ -444,23 +480,26 @@ linters-settings:
444
480
gofumpt :
445
481
# Select the Go version to target.
446
482
# Default: 1.15
447
- lang-version : " 1.15 "
483
+ lang-version : " 1.17 "
448
484
449
485
# Choose whether to use the extra rules.
450
486
# Default: false
451
487
extra-rules : true
452
488
453
489
goheader :
490
+ # Supports two types 'const` and `regexp`.
491
+ # Values can be used recursively.
454
492
values :
455
493
const :
456
494
# Define here const type values in format k:v.
457
495
# For example:
458
- # COMPANY: MY COMPANY
496
+ COMPANY : MY COMPANY
459
497
regexp :
460
498
# Define here regexp type values.
461
499
# for example:
462
- # AUTHOR: .*@mycompany\.com
463
- template : # |-
500
+ AUTHOR : .*@mycompany\.com
501
+ # The template use for checking.
502
+ template : |-
464
503
# Put here copyright header template for source code files
465
504
# For example:
466
505
# Note: {{ YEAR }} is a builtin value that returns the year relative to the current machine time.
@@ -479,8 +518,9 @@ linters-settings:
479
518
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
480
519
# See the License for the specific language governing permissions and
481
520
# limitations under the License.
482
- template-path :
483
- # Also, as alternative of directive 'template' you may put the path to file with the template source.
521
+ # As alternative of directive 'template', you may put the path to file with the template source.
522
+ # Useful if you need to load the template from a specific file.
523
+ template-path : /path/to/my/template.tmpl
484
524
485
525
goimports :
486
526
# Put imports beginning with prefix after 3rd-party packages.
@@ -575,18 +615,26 @@ linters-settings:
575
615
- G401
576
616
- G306
577
617
- G101
618
+
578
619
# To specify a set of rules to explicitly exclude.
579
620
# Available rules: https://github.com/securego/gosec#available-rules
580
621
excludes :
581
622
- G204
623
+
582
624
# Exclude generated files
625
+ # Default: false
583
626
exclude-generated : true
627
+
584
628
# Filter out the issues with a lower severity than the given value.
585
629
# Valid options are: low, medium, high.
586
- severity : " low"
630
+ # Default: low
631
+ severity : medium
632
+
587
633
# Filter out the issues with a lower confidence than the given value.
588
634
# Valid options are: low, medium, high.
589
- confidence : " low"
635
+ # Default: low
636
+ confidence : medium
637
+
590
638
# To specify the configuration of rules.
591
639
# The configuration of rules is not fully documented by gosec:
592
640
# https://github.com/securego/gosec#configuration
@@ -730,9 +778,11 @@ linters-settings:
730
778
ifshort :
731
779
# Maximum length of variable declaration measured in number of lines, after which linter won't suggest using short syntax.
732
780
# Has higher priority than max-decl-chars.
733
- max-decl-lines : 1
781
+ # Default: 1
782
+ max-decl-lines : 2
734
783
# Maximum length of variable declaration measured in number of characters, after which linter won't suggest using short syntax.
735
- max-decl-chars : 30
784
+ # Default: 30
785
+ max-decl-chars : 40
736
786
737
787
importas :
738
788
# Do not allow unaliased imports of aliased packages.
@@ -834,15 +884,16 @@ linters-settings:
834
884
nlreturn :
835
885
# Size of the block (including return statement that is still "OK")
836
886
# so no return split required.
837
- block-size : 1
887
+ # Default: 1
888
+ block-size : 2
838
889
839
890
nolintlint :
840
891
# Disable to ensure that all nolint directives actually have an effect.
841
892
# Default: false
842
- allow-unused : false
893
+ allow-unused : true
843
894
# Disable to ensure that nolint directives don't have a leading space.
844
895
# Default: true
845
- allow-leading-space : true
896
+ allow-leading-space : false
846
897
# Exclude following linters from requiring an explanation.
847
898
# Default: []
848
899
allow-no-explanation : [ ]
@@ -869,9 +920,11 @@ linters-settings:
869
920
870
921
predeclared :
871
922
# Comma-separated list of predeclared identifiers to not report on.
872
- ignore : " "
923
+ # Default: ""
924
+ ignore : " new,int"
873
925
# Include method names and field names (i.e., qualified names) in checks.
874
- q : false
926
+ # Default: false
927
+ q : true
875
928
876
929
promlinter :
877
930
# Promlinter cannot infer all metrics name in static analysis.
@@ -1197,13 +1250,15 @@ linters-settings:
1197
1250
- github.com/jmoiron/sqlx
1198
1251
1199
1252
staticcheck :
1200
- # Select the Go version to target. The default is '1.13'.
1253
+ # Select the Go version to target.
1254
+ # Default: 1.13
1201
1255
go : " 1.15"
1202
1256
# https://staticcheck.io/docs/options#checks
1203
1257
checks : [ "all" ]
1204
1258
1205
1259
stylecheck :
1206
- # Select the Go version to target. The default is '1.13'.
1260
+ # Select the Go version to target.
1261
+ # Default: 1.13
1207
1262
go : " 1.15"
1208
1263
# https://staticcheck.io/docs/options#checks
1209
1264
checks : [ "all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022" ]
@@ -1269,6 +1324,7 @@ linters-settings:
1269
1324
1270
1325
varcheck :
1271
1326
# Check usage of exported fields and variables.
1327
+ # Default: false
1272
1328
exported-fields : true
1273
1329
1274
1330
varnamelen :
@@ -1313,9 +1369,11 @@ linters-settings:
1313
1369
1314
1370
whitespace :
1315
1371
# Enforces newlines (or comments) after every multi-line if statement.
1316
- multi-if : false
1372
+ # Default: false
1373
+ multi-if : true
1317
1374
# Enforces newlines (or comments) after every multi-line function signature.
1318
- multi-func : false
1375
+ # Default: false
1376
+ multi-func : true
1319
1377
1320
1378
wrapcheck :
1321
1379
# An array of strings that specify substrings of signatures to ignore.
@@ -1405,6 +1463,7 @@ linters-settings:
1405
1463
# Optional.
1406
1464
original-url : github.com/golangci/example-linter
1407
1465
1466
+
1408
1467
linters :
1409
1468
# Disable all linters.
1410
1469
disable-all : true
@@ -1687,6 +1746,7 @@ issues:
1687
1746
# Fix found issues (if it's supported by the linter).
1688
1747
fix : true
1689
1748
1749
+
1690
1750
severity :
1691
1751
# Set the default severity for issues.
1692
1752
#
0 commit comments