Skip to content

Commit f65e45e

Browse files
ldezSeigeC
authored andcommitted
feat: remove some go1.18 limitations (golangci#3001)
* fix: restore some linters - govet(nilness,unusedwrite) - bodyclose - contextcheck - nilerr - noctx - tparallel * fix: remove structcheck from the default linters.
1 parent d2e219b commit f65e45e

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

pkg/golinters/govet.go

-5
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,6 @@ func analyzersFromConfig(settings *config.GovetSettings) []*analysis.Analyzer {
155155
}
156156

157157
func isAnalyzerEnabled(name string, cfg *config.GovetSettings, defaultAnalyzers []*analysis.Analyzer) bool {
158-
if (name == nilness.Analyzer.Name || name == unusedwrite.Analyzer.Name) &&
159-
config.IsGreaterThanOrEqualGo118(cfg.Go) {
160-
return false
161-
}
162-
163158
if cfg.EnableAll {
164159
for _, n := range cfg.Disable {
165160
if n == name {

pkg/lint/lintersdb/manager.go

+6-13
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
288288
WithSince("v1.18.0").
289289
WithLoadForGoAnalysis().
290290
WithPresets(linter.PresetPerformance, linter.PresetBugs).
291-
WithURL("https://github.com/timakin/bodyclose").
292-
WithNoopFallback(m.cfg),
291+
WithURL("https://github.com/timakin/bodyclose"),
293292

294293
linter.NewConfig(golinters.NewContainedCtx()).
295294
WithSince("1.44.0").
@@ -300,8 +299,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
300299
WithSince("v1.43.0").
301300
WithPresets(linter.PresetBugs).
302301
WithLoadForGoAnalysis().
303-
WithURL("https://github.com/sylvia7788/contextcheck").
304-
WithNoopFallback(m.cfg),
302+
WithURL("https://github.com/sylvia7788/contextcheck"),
305303

306304
linter.NewConfig(golinters.NewCyclop(cyclopCfg)).
307305
WithSince("v1.37.0").
@@ -561,8 +559,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
561559
WithLoadForGoAnalysis().
562560
WithPresets(linter.PresetStyle).
563561
WithURL("https://github.com/mvdan/interfacer").
564-
Deprecated("The repository of the linter has been archived by the owner.", "v1.38.0", "").
565-
WithNoopFallback(m.cfg),
562+
Deprecated("The repository of the linter has been archived by the owner.", "v1.38.0", ""),
566563

567564
linter.NewConfig(golinters.NewIreturn(ireturnCfg)).
568565
WithSince("v1.43.0").
@@ -612,8 +609,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
612609
WithSince("v1.38.0").
613610
WithLoadForGoAnalysis().
614611
WithPresets(linter.PresetBugs).
615-
WithURL("https://github.com/gostaticanalysis/nilerr").
616-
WithNoopFallback(m.cfg),
612+
WithURL("https://github.com/gostaticanalysis/nilerr"),
617613

618614
linter.NewConfig(golinters.NewNilNil(nilNilCfg)).
619615
WithSince("v1.43.0").
@@ -630,8 +626,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
630626
WithSince("v1.28.0").
631627
WithLoadForGoAnalysis().
632628
WithPresets(linter.PresetPerformance, linter.PresetBugs).
633-
WithURL("https://github.com/sonatard/noctx").
634-
WithNoopFallback(m.cfg),
629+
WithURL("https://github.com/sonatard/noctx"),
635630

636631
linter.NewConfig(golinters.NewNoNamedReturns(noNamedReturnsCfg)).
637632
WithSince("v1.46.0").
@@ -742,8 +737,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
742737
WithSince("v1.32.0").
743738
WithPresets(linter.PresetStyle, linter.PresetTest).
744739
WithLoadForGoAnalysis().
745-
WithURL("https://github.com/moricho/tparallel").
746-
WithNoopFallback(m.cfg),
740+
WithURL("https://github.com/moricho/tparallel"),
747741

748742
linter.NewConfig(golinters.NewTypecheck()).
749743
WithSince("v1.3.0").
@@ -824,7 +818,6 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
824818
golinters.NewStaticcheck(staticcheckCfg).Name(): true,
825819
golinters.NewUnused(unusedCfg).Name(): true,
826820
golinters.NewGosimple(gosimpleCfg).Name(): true,
827-
golinters.NewStructcheck(structcheckCfg).Name(): true,
828821
golinters.NewVarcheck(varcheckCfg).Name(): true,
829822
golinters.NewIneffassign().Name(): true,
830823
golinters.NewDeadcode().Name(): true,

0 commit comments

Comments
 (0)