github.com/vanstinator/golangci-lint@v0.0.0-20240223191551-cc572f00d9d1/pkg/golinters/spancheck.go (about) 1 package golinters 2 3 import ( 4 "github.com/jjti/go-spancheck" 5 "golang.org/x/tools/go/analysis" 6 7 "github.com/vanstinator/golangci-lint/pkg/config" 8 "github.com/vanstinator/golangci-lint/pkg/golinters/goanalysis" 9 ) 10 11 func NewSpancheck(settings *config.SpancheckSettings) *goanalysis.Linter { 12 cfg := spancheck.NewDefaultConfig() 13 14 if settings != nil { 15 if settings.Checks != nil { 16 cfg.EnabledChecks = settings.Checks 17 } 18 19 if settings.IgnoreCheckSignatures != nil { 20 cfg.IgnoreChecksSignaturesSlice = settings.IgnoreCheckSignatures 21 } 22 } 23 24 a := spancheck.NewAnalyzerWithConfig(cfg) 25 26 return goanalysis. 27 NewLinter(a.Name, a.Doc, []*analysis.Analyzer{a}, nil). 28 WithLoadMode(goanalysis.LoadModeTypesInfo) 29 }