@@ -128,6 +128,26 @@ linters-settings:
128
128
# default: true (disabled)
129
129
disable-dec-num-check : false
130
130
131
+ depguard :
132
+ list-type : denylist
133
+ include-go-root : false
134
+ packages :
135
+ - github.com/sirupsen/logrus
136
+ packages-with-error-message :
137
+ # specify an error message to output when a denied package is used
138
+ - github.com/sirupsen/logrus : " logging is allowed only by logutils.Log"
139
+ # create additional guards that follow the same configuration pattern
140
+ # results from all guards are aggregated together
141
+ additional-guards :
142
+ - list-type : denylist
143
+ include-go-root : false
144
+ packages :
145
+ - github.com/stretchr/testify
146
+ # specify rules by which the linter ignores certain files for consideration
147
+ ignore-file-rules :
148
+ - " **/*_test.go"
149
+ - " **/mock/**/*.go"
150
+
131
151
dogsled :
132
152
# checks assignments with too many blank identifiers; default is 2
133
153
max-blank-identifiers : 2
@@ -163,9 +183,9 @@ linters-settings:
163
183
- io.Copy(os.Stdout)
164
184
165
185
errchkjson :
166
- # with check-error-free-encoding set to true, errchkjson does warn about errors
186
+ # With check-error-free-encoding set to true, errchkjson does warn about errors
167
187
# from json encoding functions that are safe to be ignored,
168
- # because they are not possible to happen (default false)
188
+ # because they are not possible to happen.
169
189
#
170
190
# if check-error-free-encoding is set to true and errcheck linter is enabled,
171
191
# it is recommended to add the following exceptions to prevent from false positives:
@@ -175,9 +195,12 @@ linters-settings:
175
195
# exclude-functions:
176
196
# - encoding/json.Marshal
177
197
# - encoding/json.MarshalIndent
178
- # - (*encoding/json.Encoder).Encode
179
- check-error-free-encoding : false
180
- # if report-no-exported is true, encoding a struct without exported fields is reported as issue (default false)
198
+ #
199
+ # default: false
200
+ check-error-free-encoding : true
201
+
202
+ # Issue on struct encoding that doesn't have exported fields.
203
+ # default: false
181
204
report-no-exported : false
182
205
183
206
errorlint :
@@ -210,11 +233,12 @@ linters-settings:
210
233
- ' example.com/package.ExampleStruct'
211
234
212
235
forbidigo :
213
- # Forbid the following identifiers (identifiers are written using regexp):
236
+ # Forbid the following identifiers (list of regexp):
214
237
forbid :
215
238
- ^print.*$
216
239
- ' fmt\.Print.*'
217
- # Exclude godoc examples from forbidigo checks. Default is true.
240
+ # Exclude godoc examples from forbidigo checks.
241
+ # default: true
218
242
exclude_godoc_examples : false
219
243
220
244
funlen :
@@ -228,25 +252,34 @@ linters-settings:
228
252
local-prefixes : github.com/org/project
229
253
230
254
gocognit :
231
- # minimal code complexity to report, 30 by default (but we recommend 10-20)
255
+ # Minimal code complexity to report
256
+ # default: 30, (but we recommended 10-20)
232
257
min-complexity : 10
233
258
234
259
goconst :
235
- # minimal length of string constant, 3 by default
260
+ # Minimal length of string constant
261
+ # default: 3
236
262
min-len : 3
237
- # minimum occurrences of constant string count to trigger issue, 3 by default
263
+ # Minimum occurrences of constant string count to trigger issue
264
+ # default: 3
238
265
min-occurrences : 3
239
- # ignore test files, false by default
266
+ # Ignore test files
267
+ # default: false
240
268
ignore-tests : false
241
- # look for existing constants matching the values, true by default
269
+ # Look for existing constants matching the values
270
+ # default: true
242
271
match-constant : true
243
- # search also for duplicated numbers, false by default
272
+ # Search also for duplicated numbers.
273
+ # default: false
244
274
numbers : false
245
- # minimum value, only works with goconst.numbers, 3 by default
275
+ # Minimum value, only works with goconst.numbers
276
+ # default: 3
246
277
min : 3
247
- # maximum value, only works with goconst.numbers, 3 by default
278
+ # Maximum value, only works with goconst.numbers
279
+ # default: 3
248
280
max : 3
249
- # ignore when constant is not used as function argument, true by default
281
+ # Ignore when constant is not used as function argument
282
+ # default: true
250
283
ignore-calls : true
251
284
252
285
gocritic :
@@ -468,6 +501,12 @@ linters-settings:
468
501
# reason: "testing if blocked version constraint works." # Reason why the version constraint exists. (Optional)
469
502
local_replace_directives : false # Set to true to raise lint issues for packages that are loaded from a local path via replace directive
470
503
504
+ gosimple :
505
+ # Select the Go version to target. The default is '1.13'.
506
+ go : " 1.15"
507
+ # https://staticcheck.io/docs/options#checks
508
+ checks : [ "all" ]
509
+
471
510
gosec :
472
511
# To select a subset of rules to run.
473
512
# Available rules: https://github.com/securego/gosec#available-rules
@@ -498,12 +537,6 @@ linters-settings:
498
537
per_char_threshold : " 3.0"
499
538
truncate : " 32"
500
539
501
- gosimple :
502
- # Select the Go version to target. The default is '1.13'.
503
- go : " 1.15"
504
- # https://staticcheck.io/docs/options#checks
505
- checks : [ "all" ]
506
-
507
540
govet :
508
541
# report about shadowed variables
509
542
check-shadowing : true
@@ -526,26 +559,6 @@ linters-settings:
526
559
- shadow
527
560
disable-all : false
528
561
529
- depguard :
530
- list-type : denylist
531
- include-go-root : false
532
- packages :
533
- - github.com/sirupsen/logrus
534
- packages-with-error-message :
535
- # specify an error message to output when a denied package is used
536
- - github.com/sirupsen/logrus : " logging is allowed only by logutils.Log"
537
- # create additional guards that follow the same configuration pattern
538
- # results from all guards are aggregated together
539
- additional-guards :
540
- - list-type : denylist
541
- include-go-root : false
542
- packages :
543
- - github.com/stretchr/testify
544
- # specify rules by which the linter ignores certain files for consideration
545
- ignore-file-rules :
546
- - " **/*_test.go"
547
- - " **/mock/**/*.go"
548
-
549
562
ifshort :
550
563
# Maximum length of variable declaration measured in number of lines, after which linter won't suggest using short syntax.
551
564
# Has higher priority than max-decl-chars.
@@ -591,7 +604,6 @@ linters-settings:
591
604
# You can specify idiomatic endings for interface
592
605
- (or|er)$
593
606
594
- # Reject patterns
595
607
reject :
596
608
- github.com\/user\/package\/v4\.Type
597
609
@@ -668,30 +680,26 @@ linters-settings:
668
680
range-loops : true # Report preallocation suggestions on range loops, true by default
669
681
for-loops : false # Report preallocation suggestions on for loops, false by default
670
682
671
- promlinter :
672
- # Promlinter cannot infer all metrics name in static analysis.
673
- # Enable strict mode will also include the errors caused by failing to parse the args.
674
- strict : false
675
- # Please refer to https://github.com/yeya24/promlinter#usage for detailed usage.
676
- disabled-linters :
677
- # - "Help"
678
- # - "MetricUnits"
679
- # - "Counter"
680
- # - "HistogramSummaryReserved"
681
- # - "MetricTypeInName"
682
- # - "ReservedChars"
683
- # - "CamelCase"
684
- # - "lintUnitAbbreviations"
685
-
686
683
predeclared :
687
684
# comma-separated list of predeclared identifiers to not report on
688
685
ignore : " "
689
686
# include method names and field names (i.e., qualified names) in checks
690
687
q : false
691
688
692
- rowserrcheck :
693
- packages :
694
- - github.com/jmoiron/sqlx
689
+ promlinter :
690
+ # Promlinter cannot infer all metrics name in static analysis.
691
+ # Enable strict mode will also include the errors caused by failing to parse the args.
692
+ strict : false
693
+ # Please refer to https://github.com/yeya24/promlinter#usage for detailed usage.
694
+ disabled-linters :
695
+ - " Help"
696
+ - " MetricUnits"
697
+ - " Counter"
698
+ - " HistogramSummaryReserved"
699
+ - " MetricTypeInName"
700
+ - " ReservedChars"
701
+ - " CamelCase"
702
+ - " UnitAbbreviations"
695
703
696
704
revive :
697
705
# see https://github.com/mgechev/revive#available-rules for details.
@@ -996,6 +1004,10 @@ linters-settings:
996
1004
severity : warning
997
1005
disable : false
998
1006
1007
+ rowserrcheck :
1008
+ packages :
1009
+ - github.com/jmoiron/sqlx
1010
+
999
1011
staticcheck :
1000
1012
# Select the Go version to target. The default is '1.13'.
1001
1013
go : " 1.15"
@@ -1030,6 +1042,11 @@ linters-settings:
1030
1042
avro : snake
1031
1043
mapstructure : kebab
1032
1044
1045
+ tenv :
1046
+ # The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures.
1047
+ # By default, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked.
1048
+ all : false
1049
+
1033
1050
testpackage :
1034
1051
# regexp pattern to skip files
1035
1052
skip-regexp : (export|internal)_test\.go
@@ -1050,10 +1067,6 @@ linters-settings:
1050
1067
name : true
1051
1068
begin : true
1052
1069
1053
- tenv :
1054
- # The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures.
1055
- # By default, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked.
1056
- all : false
1057
1070
1058
1071
unparam :
1059
1072
# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
@@ -1062,9 +1075,9 @@ linters-settings:
1062
1075
# with golangci-lint call it on a directory with the changed file.
1063
1076
check-exported : false
1064
1077
1065
- unused :
1066
- # Select the Go version to target. The default is '1.13' .
1067
- go : " 1.15 "
1078
+ varcheck :
1079
+ # Check usage of exported fields and variables .
1080
+ exported-fields : true
1068
1081
1069
1082
varnamelen :
1070
1083
# The longest distance, in source lines, that is being considered a "small scope." (defaults to 5)
0 commit comments