do not error out when go.mod is missing just raise warning, change linter options
This commit is contained in:
		
							parent
							
								
									020b9e7103
								
							
						
					
					
						commit
						4292963937
					
				| @ -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) | ||||||
|  | |||||||
| @ -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"), | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Ryan Currah
						Ryan Currah