Skip to content

Commit

Permalink
govet: fix check-shadowing (#4534)
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez authored Mar 19, 2024
1 parent 2bcc010 commit 6914447
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/golinters/govet.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,6 @@ func analyzersFromConfig(settings *config.GovetSettings) []*analysis.Analyzer {
return defaultAnalyzers
}

if settings.CheckShadowing {
// Keeping for backward compatibility.
settings.Enable = append(settings.Enable, shadow.Analyzer.Name)
}

var enabledAnalyzers []*analysis.Analyzer
for _, a := range allAnalyzers {
if isAnalyzerEnabled(a.Name, settings, defaultAnalyzers) {
Expand All @@ -189,6 +184,11 @@ func isAnalyzerEnabled(name string, cfg *config.GovetSettings, defaultAnalyzers
return false
}

// Keeping for backward compatibility.
if cfg.CheckShadowing && name == shadow.Analyzer.Name {
return true
}

switch {
case cfg.EnableAll:
return !slices.Contains(cfg.Disable, name)
Expand Down

0 comments on commit 6914447

Please sign in to comment.