File tree 4 files changed +9
-3
lines changed
4 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -1159,6 +1159,10 @@ linters-settings:
1159
1159
require-specific : true
1160
1160
1161
1161
nonamedreturns :
1162
+ # Report named error if it is assigned inside defer.
1163
+ # Default: false
1164
+ report-error-in-defer : true
1165
+ # DEPRECATED use report-error-in-defer instead.
1162
1166
# Do not complain about named error, if it is assigned inside defer.
1163
1167
# Default: false
1164
1168
allow-error-in-defer : true
Original file line number Diff line number Diff line change @@ -486,7 +486,8 @@ type NoLintLintSettings struct {
486
486
}
487
487
488
488
type NoNamedReturnsSettings struct {
489
- AllowErrorInDefer bool `mapstructure:"allow-error-in-defer"`
489
+ AllowErrorInDefer bool `mapstructure:"allow-error-in-defer"` // Deprecated: use ReportErrorInDefer instead.
490
+ ReportErrorInDefer bool `mapstructure:"report-error-in-defer"`
490
491
}
491
492
type ParallelTestSettings struct {
492
493
IgnoreMissing bool `mapstructure:"ignore-missing"`
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ func NewNoNamedReturns(settings *config.NoNamedReturnsSettings) *goanalysis.Lint
15
15
if settings != nil {
16
16
cfg = map [string ]map [string ]interface {}{
17
17
a .Name : {
18
- analyzer .FlagAllowErrorInDefer : settings .AllowErrorInDefer ,
18
+ analyzer .FlagReportErrorInDefer : settings . ReportErrorInDefer || settings .AllowErrorInDefer ,
19
19
},
20
20
}
21
21
}
@@ -25,5 +25,5 @@ func NewNoNamedReturns(settings *config.NoNamedReturnsSettings) *goanalysis.Lint
25
25
a .Doc ,
26
26
[]* analysis.Analyzer {a },
27
27
cfg ,
28
- ).WithLoadMode (goanalysis .LoadModeSyntax )
28
+ ).WithLoadMode (goanalysis .LoadModeTypesInfo )
29
29
}
Original file line number Diff line number Diff line change @@ -627,6 +627,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
627
627
628
628
linter .NewConfig (golinters .NewNoNamedReturns (noNamedReturnsCfg )).
629
629
WithSince ("v1.46.0" ).
630
+ WithLoadForGoAnalysis ().
630
631
WithPresets (linter .PresetStyle ).
631
632
WithURL ("https://github.com/firefart/nonamedreturns" ),
632
633
You can’t perform that action at this time.
0 commit comments