@@ -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
@@ -596,7 +629,6 @@ linters-settings:
596
629
# You can specify idiomatic endings for interface
597
630
- (or|er)$
598
631
599
- # Reject patterns
600
632
reject :
601
633
- github.com\/user\/package\/v4\.Type
602
634
@@ -673,30 +705,26 @@ linters-settings:
673
705
range-loops : true # Report preallocation suggestions on range loops, true by default
674
706
for-loops : false # Report preallocation suggestions on for loops, false by default
675
707
676
- promlinter :
677
- # Promlinter cannot infer all metrics name in static analysis.
678
- # Enable strict mode will also include the errors caused by failing to parse the args.
679
- strict : false
680
- # Please refer to https://github.com/yeya24/promlinter#usage for detailed usage.
681
- disabled-linters :
682
- # - "Help"
683
- # - "MetricUnits"
684
- # - "Counter"
685
- # - "HistogramSummaryReserved"
686
- # - "MetricTypeInName"
687
- # - "ReservedChars"
688
- # - "CamelCase"
689
- # - "lintUnitAbbreviations"
690
-
691
708
predeclared :
692
709
# comma-separated list of predeclared identifiers to not report on
693
710
ignore : " "
694
711
# include method names and field names (i.e., qualified names) in checks
695
712
q : false
696
713
697
- rowserrcheck :
698
- packages :
699
- - github.com/jmoiron/sqlx
714
+ promlinter :
715
+ # Promlinter cannot infer all metrics name in static analysis.
716
+ # Enable strict mode will also include the errors caused by failing to parse the args.
717
+ strict : false
718
+ # Please refer to https://github.com/yeya24/promlinter#usage for detailed usage.
719
+ disabled-linters :
720
+ - " Help"
721
+ - " MetricUnits"
722
+ - " Counter"
723
+ - " HistogramSummaryReserved"
724
+ - " MetricTypeInName"
725
+ - " ReservedChars"
726
+ - " CamelCase"
727
+ - " UnitAbbreviations"
700
728
701
729
revive :
702
730
# see https://github.com/mgechev/revive#available-rules for details.
@@ -1001,6 +1029,10 @@ linters-settings:
1001
1029
severity : warning
1002
1030
disable : false
1003
1031
1032
+ rowserrcheck :
1033
+ packages :
1034
+ - github.com/jmoiron/sqlx
1035
+
1004
1036
staticcheck :
1005
1037
# Select the Go version to target. The default is '1.13'.
1006
1038
go : " 1.15"
@@ -1035,6 +1067,11 @@ linters-settings:
1035
1067
avro : snake
1036
1068
mapstructure : kebab
1037
1069
1070
+ tenv :
1071
+ # The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures.
1072
+ # By default, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked.
1073
+ all : false
1074
+
1038
1075
testpackage :
1039
1076
# regexp pattern to skip files
1040
1077
skip-regexp : (export|internal)_test\.go
@@ -1055,10 +1092,6 @@ linters-settings:
1055
1092
name : true
1056
1093
begin : true
1057
1094
1058
- tenv :
1059
- # The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures.
1060
- # By default, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked.
1061
- all : false
1062
1095
1063
1096
unparam :
1064
1097
# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
@@ -1067,9 +1100,9 @@ linters-settings:
1067
1100
# with golangci-lint call it on a directory with the changed file.
1068
1101
check-exported : false
1069
1102
1070
- unused :
1071
- # Select the Go version to target. The default is '1.13' .
1072
- go : " 1.15 "
1103
+ varcheck :
1104
+ # Check usage of exported fields and variables .
1105
+ exported-fields : true
1073
1106
1074
1107
varnamelen :
1075
1108
# The longest distance, in source lines, that is being considered a "small scope." (defaults to 5)
0 commit comments