Skip to content

Commit 4292963

Browse files
committed
do not error out when go.mod is missing just raise warning, change linter options
1 parent 020b9e7 commit 4292963

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

pkg/golinters/gomodguard.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ func NewGomodguard() *goanalysis.Linter {
5959

6060
processor, err := gomodguard.NewProcessor(processorCfg, log.New(os.Stderr, "", 0))
6161
if err != nil {
62-
return nil, err
62+
lintCtx.Log.Warnf("running gomodguard failed: %s: if you are not using go modules "+
63+
"it is suggested to disable this linter", err)
64+
return nil, nil
6365
}
6466

6567
gomodguardErrors := processor.ProcessFiles(files)

pkg/lint/lintersdb/manager.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
249249
WithURL("https://github.com/tommy-muehle/go-mnd"),
250250
linter.NewConfig(golinters.NewGomodguard()).
251251
WithPresets(linter.PresetStyle).
252+
WithLoadForGoAnalysis().
252253
WithURL("https://github.com/rcurrah/gomodguard"),
253254
}
254255

0 commit comments

Comments
 (0)