File tree Expand file tree Collapse file tree 4 files changed +9
-3
lines changed Expand file tree Collapse file tree 4 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -1159,6 +1159,10 @@ linters-settings:
11591159 require-specific : true
11601160
11611161 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.
11621166 # Do not complain about named error, if it is assigned inside defer.
11631167 # Default: false
11641168 allow-error-in-defer : true
Original file line number Diff line number Diff line change @@ -486,7 +486,8 @@ type NoLintLintSettings struct {
486486}
487487
488488type 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"`
490491}
491492type ParallelTestSettings struct {
492493 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
1515 if settings != nil {
1616 cfg = map [string ]map [string ]interface {}{
1717 a .Name : {
18- analyzer .FlagAllowErrorInDefer : settings .AllowErrorInDefer ,
18+ analyzer .FlagReportErrorInDefer : settings . ReportErrorInDefer || settings .AllowErrorInDefer ,
1919 },
2020 }
2121 }
@@ -25,5 +25,5 @@ func NewNoNamedReturns(settings *config.NoNamedReturnsSettings) *goanalysis.Lint
2525 a .Doc ,
2626 []* analysis.Analyzer {a },
2727 cfg ,
28- ).WithLoadMode (goanalysis .LoadModeSyntax )
28+ ).WithLoadMode (goanalysis .LoadModeTypesInfo )
2929}
Original file line number Diff line number Diff line change @@ -627,6 +627,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
627627
628628 linter .NewConfig (golinters .NewNoNamedReturns (noNamedReturnsCfg )).
629629 WithSince ("v1.46.0" ).
630+ WithLoadForGoAnalysis ().
630631 WithPresets (linter .PresetStyle ).
631632 WithURL ("https://github.com/firefart/nonamedreturns" ),
632633
You can’t perform that action at this time.
0 commit comments