From f9ae82ae3d6401dd9cddae98585ac6f26c0932d0 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Thu, 21 Jul 2022 01:59:04 +0200 Subject: [PATCH 1/2] fix: restore some linters - govet(nilness,unusedwrite) - bodyclose - contextcheck - nilerr - noctx - tparallel --- pkg/golinters/govet.go | 5 ----- pkg/lint/lintersdb/manager.go | 18 ++++++------------ 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/pkg/golinters/govet.go b/pkg/golinters/govet.go index 3f005c1d5cc2..4991160a8b3c 100644 --- a/pkg/golinters/govet.go +++ b/pkg/golinters/govet.go @@ -155,11 +155,6 @@ func analyzersFromConfig(settings *config.GovetSettings) []*analysis.Analyzer { } func isAnalyzerEnabled(name string, cfg *config.GovetSettings, defaultAnalyzers []*analysis.Analyzer) bool { - if (name == nilness.Analyzer.Name || name == unusedwrite.Analyzer.Name) && - config.IsGreaterThanOrEqualGo118(cfg.Go) { - return false - } - if cfg.EnableAll { for _, n := range cfg.Disable { if n == name { diff --git a/pkg/lint/lintersdb/manager.go b/pkg/lint/lintersdb/manager.go index 0d1f37e611a6..2ba353241fce 100644 --- a/pkg/lint/lintersdb/manager.go +++ b/pkg/lint/lintersdb/manager.go @@ -288,8 +288,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config { WithSince("v1.18.0"). WithLoadForGoAnalysis(). WithPresets(linter.PresetPerformance, linter.PresetBugs). - WithURL("https://github.com/timakin/bodyclose"). - WithNoopFallback(m.cfg), + WithURL("https://github.com/timakin/bodyclose"), linter.NewConfig(golinters.NewContainedCtx()). WithSince("1.44.0"). @@ -300,8 +299,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config { WithSince("v1.43.0"). WithPresets(linter.PresetBugs). WithLoadForGoAnalysis(). - WithURL("https://github.com/sylvia7788/contextcheck"). - WithNoopFallback(m.cfg), + WithURL("https://github.com/sylvia7788/contextcheck"), linter.NewConfig(golinters.NewCyclop(cyclopCfg)). WithSince("v1.37.0"). @@ -561,8 +559,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config { WithLoadForGoAnalysis(). WithPresets(linter.PresetStyle). WithURL("https://github.com/mvdan/interfacer"). - Deprecated("The repository of the linter has been archived by the owner.", "v1.38.0", ""). - WithNoopFallback(m.cfg), + Deprecated("The repository of the linter has been archived by the owner.", "v1.38.0", ""), linter.NewConfig(golinters.NewIreturn(ireturnCfg)). WithSince("v1.43.0"). @@ -612,8 +609,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config { WithSince("v1.38.0"). WithLoadForGoAnalysis(). WithPresets(linter.PresetBugs). - WithURL("https://github.com/gostaticanalysis/nilerr"). - WithNoopFallback(m.cfg), + WithURL("https://github.com/gostaticanalysis/nilerr"), linter.NewConfig(golinters.NewNilNil(nilNilCfg)). WithSince("v1.43.0"). @@ -630,8 +626,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config { WithSince("v1.28.0"). WithLoadForGoAnalysis(). WithPresets(linter.PresetPerformance, linter.PresetBugs). - WithURL("https://github.com/sonatard/noctx"). - WithNoopFallback(m.cfg), + WithURL("https://github.com/sonatard/noctx"), linter.NewConfig(golinters.NewNoNamedReturns(noNamedReturnsCfg)). WithSince("v1.46.0"). @@ -742,8 +737,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config { WithSince("v1.32.0"). WithPresets(linter.PresetStyle, linter.PresetTest). WithLoadForGoAnalysis(). - WithURL("https://github.com/moricho/tparallel"). - WithNoopFallback(m.cfg), + WithURL("https://github.com/moricho/tparallel"), linter.NewConfig(golinters.NewTypecheck()). WithSince("v1.3.0"). From a2fe82e05fdad9c998514e865e8b1457b05a80a7 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Thu, 21 Jul 2022 16:30:45 +0200 Subject: [PATCH 2/2] fix: remove structcheck from the default linters. --- pkg/lint/lintersdb/manager.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/lint/lintersdb/manager.go b/pkg/lint/lintersdb/manager.go index 2ba353241fce..048143018dc4 100644 --- a/pkg/lint/lintersdb/manager.go +++ b/pkg/lint/lintersdb/manager.go @@ -815,7 +815,6 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config { golinters.NewStaticcheck(staticcheckCfg).Name(): true, golinters.NewUnused(unusedCfg).Name(): true, golinters.NewGosimple(gosimpleCfg).Name(): true, - golinters.NewStructcheck(structcheckCfg).Name(): true, golinters.NewVarcheck(varcheckCfg).Name(): true, golinters.NewIneffassign().Name(): true, golinters.NewDeadcode().Name(): true,