@@ -35,6 +35,7 @@ linters:
35
35
- exhaustive
36
36
- exhaustruct
37
37
- exportloopref
38
+ - exptostd
38
39
- fatcontext
39
40
- forbidigo
40
41
- forcetypeassert
@@ -81,6 +82,7 @@ linters:
81
82
- nakedret
82
83
- nestif
83
84
- nilerr
85
+ - nilnesserr
84
86
- nilnil
85
87
- nlreturn
86
88
- noctx
@@ -114,6 +116,7 @@ linters:
114
116
- unparam
115
117
- unused
116
118
- usestdlibvars
119
+ - usetesting
117
120
- varnamelen
118
121
- wastedassign
119
122
- whitespace
@@ -151,6 +154,7 @@ linters:
151
154
- exhaustive
152
155
- exhaustruct
153
156
- exportloopref
157
+ - exptostd
154
158
- fatcontext
155
159
- forbidigo
156
160
- forcetypeassert
@@ -197,6 +201,7 @@ linters:
197
201
- nakedret
198
202
- nestif
199
203
- nilerr
204
+ - nilnesserr
200
205
- nilnil
201
206
- nlreturn
202
207
- noctx
@@ -230,6 +235,7 @@ linters:
230
235
- unparam
231
236
- unused
232
237
- usestdlibvars
238
+ - usetesting
233
239
- varnamelen
234
240
- wastedassign
235
241
- whitespace
@@ -592,6 +598,14 @@ linters-settings:
592
598
- alias # Alias section: contains all alias imports. This section is not present unless explicitly enabled.
593
599
- localmodule # Local module section: contains all local packages. This section is not present unless explicitly enabled.
594
600
601
+ # Checks that no inline Comments are present.
602
+ # Default: false
603
+ no-inline-comments : true
604
+
605
+ # Checks that no prefix Comments(comment lines above an import) are present.
606
+ # Default: false
607
+ no-prefix-comments : true
608
+
595
609
# Skip generated files.
596
610
# Default: true
597
611
skip-generated : false
@@ -660,6 +674,9 @@ linters-settings:
660
674
# Presence of `default` case in switch statements satisfies exhaustiveness, if all members are not listed.
661
675
# Default: true
662
676
default-signifies-exhaustive : false
677
+ # Include shared interfaces in the exhaustiviness check.
678
+ # Default: false
679
+ include-shared-interfaces : true
663
680
664
681
gocognit :
665
682
# Minimal code complexity to report.
@@ -1354,18 +1371,31 @@ linters-settings:
1354
1371
# Allow local `replace` directives.
1355
1372
# Default: false
1356
1373
replace-local : true
1357
-
1358
1374
# List of allowed `replace` directives.
1359
1375
# Default: []
1360
1376
replace-allow-list :
1361
1377
- launchpad.net/gocheck
1362
1378
# Allow to not explain why the version has been retracted in the `retract` directives.
1363
1379
# Default: false
1364
1380
retract-allow-no-explanation : true
1365
-
1366
1381
# Forbid the use of the `exclude` directives.
1367
1382
# Default: false
1368
1383
exclude-forbidden : true
1384
+ # Forbid the use of the `toolchain` directive.
1385
+ # Default: false
1386
+ toolchain-forbidden : true
1387
+ # Defines a pattern to validate `toolchain` directive.
1388
+ # Default: '' (no match)
1389
+ toolchain-pattern : ' go1\.23\.\d+$'
1390
+ # Forbid the use of the `tool` directives.
1391
+ # Default: false
1392
+ tool-forbidden : true
1393
+ # Forbid the use of the `godebug` directive.
1394
+ # Default: false
1395
+ go-debug-forbidden : true
1396
+ # Defines a pattern to validate `go` minimum version directive.
1397
+ # Default: '' (no match)
1398
+ go-version-pattern : ' \d\.\d+(\.0)?'
1369
1399
1370
1400
gomodguard :
1371
1401
allowed :
@@ -1803,6 +1833,8 @@ linters-settings:
1803
1833
- sortslice
1804
1834
# Check signature of methods of well-known interfaces.
1805
1835
- stdmethods
1836
+ # Check for uses of too-new standard library symbols.
1837
+ - stdversion
1806
1838
# Check for string(int) conversions.
1807
1839
- stringintconv
1808
1840
# Check that struct field tags conform to reflect.StructTag.Get.
@@ -1823,6 +1855,8 @@ linters-settings:
1823
1855
- unusedresult
1824
1856
# Checks for unused writes.
1825
1857
- unusedwrite
1858
+ # Checks for misuses of sync.WaitGroup.
1859
+ - waitgroup
1826
1860
1827
1861
# Enable all analyzers.
1828
1862
# Default: false
@@ -1971,6 +2005,11 @@ linters-settings:
1971
2005
# see https://github.com/julz/importas#use-regular-expression for details
1972
2006
- pkg : knative.dev/serving/pkg/apis/(\w+)/(v[\w\d]+)
1973
2007
alias : $1$2
2008
+ # An explicit empty alias can be used to ensure no aliases are used for a package.
2009
+ # This can be useful if `no-extra-aliases: true` doesn't fit your need.
2010
+ # Multiple packages can use an empty alias.
2011
+ - pkg : errors
2012
+ alias : " "
1974
2013
1975
2014
inamedparam :
1976
2015
# Skips check for interface methods with only a single parameter.
@@ -2034,6 +2073,9 @@ linters-settings:
2034
2073
# Allow check for the github.com/go-logr/logr library.
2035
2074
# Default: true
2036
2075
logr : false
2076
+ # Allow check for the log/slog library.
2077
+ # Default: true
2078
+ slog : false
2037
2079
# Allow check for the "sugar logger" from go.uber.org/zap library.
2038
2080
# Default: true
2039
2081
zap : false
@@ -2280,6 +2322,23 @@ linters-settings:
2280
2322
patterns :
2281
2323
- " .*"
2282
2324
2325
+ recvcheck :
2326
+ # Disables the built-in method exclusions:
2327
+ # - `MarshalText`
2328
+ # - `MarshalJSON`
2329
+ # - `MarshalYAML`
2330
+ # - `MarshalXML`
2331
+ # - `MarshalBinary`
2332
+ # - `GobEncode`
2333
+ # Default: false
2334
+ disable-builtin : true
2335
+ # User-defined method exclusions.
2336
+ # The format is `struct_name.method_name` (ex: `Foo.MethodName`).
2337
+ # A wildcard `*` can use as a struct name (ex: `*.MethodName`).
2338
+ # Default: []
2339
+ exclusions :
2340
+ - " *.Value"
2341
+
2283
2342
revive :
2284
2343
# Maximum number of open files at the same time.
2285
2344
# See https://github.com/mgechev/revive#command-line-flags
@@ -3280,16 +3339,24 @@ linters-settings:
3280
3339
strict : true
3281
3340
3282
3341
tagliatelle :
3283
- # Check the struct tag name case.
3342
+ # Checks the struct tag name case.
3284
3343
case :
3285
- # Use the struct field name to check the name of the struct tag.
3286
- # Default: false
3287
- use-field-name : true
3288
- # `camel` is used for `json` and `yaml`, and `header` is used for `header` (can be overridden)
3289
- # Default: {}
3344
+ # Defines the association between tag name and case.
3345
+ # Any struct tag name can be used.
3346
+ # Supported string cases:
3347
+ # - `camel`
3348
+ # - `pascal`
3349
+ # - `kebab`
3350
+ # - `snake`
3351
+ # - `upperSnake`
3352
+ # - `goCamel`
3353
+ # - `goPascal`
3354
+ # - `goKebab`
3355
+ # - `goSnake`
3356
+ # - `upper`
3357
+ # - `lower`
3358
+ # - `header`
3290
3359
rules :
3291
- # Any struct tag type can be used.
3292
- # Support string case: `camel`, `pascal`, `kebab`, `snake`, `upperSnake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower`, `header`
3293
3360
json : camel
3294
3361
yaml : camel
3295
3362
xml : camel
@@ -3299,6 +3366,70 @@ linters-settings:
3299
3366
mapstructure : kebab
3300
3367
env : upperSnake
3301
3368
envconfig : upperSnake
3369
+ whatever : snake
3370
+ # Defines the association between tag name and case.
3371
+ # Important: the `extended-rules` overrides `rules`.
3372
+ # Default: empty
3373
+ extended-rules :
3374
+ json :
3375
+ # Supported string cases:
3376
+ # - `camel`
3377
+ # - `pascal`
3378
+ # - `kebab`
3379
+ # - `snake`
3380
+ # - `upperSnake`
3381
+ # - `goCamel`
3382
+ # - `goPascal`
3383
+ # - `goKebab`
3384
+ # - `goSnake`
3385
+ # - `header`
3386
+ # - `lower`
3387
+ # - `header`
3388
+ #
3389
+ # Required
3390
+ case : camel
3391
+ # Adds 'AMQP', 'DB', 'GID', 'RTP', 'SIP', 'TS' to initialisms,
3392
+ # and removes 'LHS', 'RHS' from initialisms.
3393
+ # Default: false
3394
+ extra-initialisms : true
3395
+ # Defines initialism additions and overrides.
3396
+ # Default: empty
3397
+ initialism-overrides :
3398
+ DB : true # add a new initialism
3399
+ LHS : false # disable a default initialism.
3400
+ # ...
3401
+ # Uses the struct field name to check the name of the struct tag.
3402
+ # Default: false
3403
+ use-field-name : true
3404
+ # The field names to ignore.
3405
+ # Default: []
3406
+ ignored-fields :
3407
+ - Bar
3408
+ - Foo
3409
+ # Overrides the default/root configuration.
3410
+ # Default: []
3411
+ overrides :
3412
+ -
3413
+ # The package path (uses `/` only as a separator).
3414
+ # Required
3415
+ pkg : foo/bar
3416
+ # Default: empty or the same as the default/root configuration.
3417
+ rules :
3418
+ json : snake
3419
+ xml : pascal
3420
+ # Default: empty or the same as the default/root configuration.
3421
+ extended-rules :
3422
+ # Same options as the base `extended-rules`.
3423
+ # Default: false (WARNING: it doesn't follow the default/root configuration)
3424
+ use-field-name : true
3425
+ # The field names to ignore.
3426
+ # Default: [] or the same as the default/root configuration.
3427
+ ignored-fields :
3428
+ - Bar
3429
+ - Foo
3430
+ # Ignore the package (takes precedence over all other configurations).
3431
+ # Default: false
3432
+ ignore : true
3302
3433
3303
3434
tenv :
3304
3435
# The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures.
@@ -3490,6 +3621,38 @@ linters-settings:
3490
3621
# Default: false
3491
3622
constant-kind : true
3492
3623
3624
+ usetesting :
3625
+ # Enable/disable `os.CreateTemp("", ...)` detections.
3626
+ # Default: true
3627
+ os-create-temp : false
3628
+
3629
+ # Enable/disable `os.MkdirTemp()` detections.
3630
+ # Default: true
3631
+ os-mkdir-temp : false
3632
+
3633
+ # Enable/disable `os.Setenv()` detections.
3634
+ # Default: false
3635
+ os-setenv : true
3636
+
3637
+ # Enable/disable `os.TempDir()` detections.
3638
+ # Default: false
3639
+ os-temp-dir : true
3640
+
3641
+ # Enable/disable `os.Chdir()` detections.
3642
+ # Disabled if Go < 1.24.
3643
+ # Default: true
3644
+ os-chdir : false
3645
+
3646
+ # Enable/disable `context.Background()` detections.
3647
+ # Disabled if Go < 1.24.
3648
+ # Default: true
3649
+ context-background : false
3650
+
3651
+ # Enable/disable `context.TODO()` detections.
3652
+ # Disabled if Go < 1.24.
3653
+ # Default: true
3654
+ context-todo : false
3655
+
3493
3656
unconvert :
3494
3657
# Remove conversions that force intermediate rounding.
3495
3658
# Default: false
@@ -3586,6 +3749,15 @@ linters-settings:
3586
3749
multi-func : true
3587
3750
3588
3751
wrapcheck :
3752
+ # An array of strings specifying additional substrings of signatures to ignore.
3753
+ # Unlike 'ignoreSigs', this option extends the default set (or the set specified in 'ignoreSigs') without replacing it entirely.
3754
+ # This allows you to add specific signatures to the ignore list
3755
+ # while retaining the defaults or any items in 'ignoreSigs'.
3756
+ # Default: []
3757
+ extra-ignore-sigs :
3758
+ - .CustomError(
3759
+ - .SpecificWrap(
3760
+
3589
3761
# An array of strings that specify substrings of signatures to ignore.
3590
3762
# If this set, it will override the default set of ignored signatures.
3591
3763
# See https://github.com/tomarrell/wrapcheck#configuration for more information.
@@ -3833,6 +4005,10 @@ issues:
3833
4005
# Default: 3
3834
4006
max-same-issues : 0
3835
4007
4008
+ # Make issues output unique by line.
4009
+ # Default: true
4010
+ uniq-by-line : false
4011
+
3836
4012
# Show only new issues: if there are unstaged changes or untracked files,
3837
4013
# only those changes are analyzed, else only changes in HEAD~ are analyzed.
3838
4014
# It's a super-useful option for integration of golangci-lint into existing large codebase.
@@ -3902,10 +4078,6 @@ output:
3902
4078
# Default: true
3903
4079
print-linter-name : false
3904
4080
3905
- # Make issues output unique by line.
3906
- # Default: true
3907
- uniq-by-line : false
3908
-
3909
4081
# Add a prefix to the output file references.
3910
4082
# Default: ""
3911
4083
path-prefix : " "
@@ -3940,6 +4112,7 @@ output:
3940
4112
# Options for analysis running.
3941
4113
run :
3942
4114
# Timeout for analysis, e.g. 30s, 5m.
4115
+ # If the value is lower or equal to 0, the timeout is disabled.
3943
4116
# Default: 1m
3944
4117
timeout : 5m
3945
4118
0 commit comments