do not error out when go.mod is missing just raise warning, change linter options

This commit is contained in:
Ryan Currah 2020-04-05 17:49:27 -04:00
parent 020b9e7103
commit 4292963937
No known key found for this signature in database
GPG Key ID: A8F5EF04CC2222B3
2 changed files with 4 additions and 1 deletions

View File

@ -59,7 +59,9 @@ func NewGomodguard() *goanalysis.Linter {
processor, err := gomodguard.NewProcessor(processorCfg, log.New(os.Stderr, "", 0)) processor, err := gomodguard.NewProcessor(processorCfg, log.New(os.Stderr, "", 0))
if err != nil { if err != nil {
return nil, err lintCtx.Log.Warnf("running gomodguard failed: %s: if you are not using go modules "+
"it is suggested to disable this linter", err)
return nil, nil
} }
gomodguardErrors := processor.ProcessFiles(files) gomodguardErrors := processor.ProcessFiles(files)

View File

@ -249,6 +249,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
WithURL("https://github.com/tommy-muehle/go-mnd"), WithURL("https://github.com/tommy-muehle/go-mnd"),
linter.NewConfig(golinters.NewGomodguard()). linter.NewConfig(golinters.NewGomodguard()).
WithPresets(linter.PresetStyle). WithPresets(linter.PresetStyle).
WithLoadForGoAnalysis().
WithURL("https://github.com/rcurrah/gomodguard"), WithURL("https://github.com/rcurrah/gomodguard"),
} }