github.com/elek/golangci-lint@v1.42.2-0.20211208090441-c05b7fcb3a9a/pkg/golinters/exhaustivestruct.go (about) 1 package golinters 2 3 import ( 4 "strings" 5 6 "github.com/mbilski/exhaustivestruct/pkg/analyzer" 7 "golang.org/x/tools/go/analysis" 8 9 "github.com/elek/golangci-lint/pkg/config" 10 "github.com/elek/golangci-lint/pkg/golinters/goanalysis" 11 ) 12 13 func NewExhaustiveStruct(settings *config.ExhaustiveStructSettings) *goanalysis.Linter { 14 a := analyzer.Analyzer 15 16 var cfg map[string]map[string]interface{} 17 if settings != nil { 18 cfg = map[string]map[string]interface{}{ 19 a.Name: { 20 "struct_patterns": strings.Join(settings.StructPatterns, ","), 21 }, 22 } 23 } 24 25 return goanalysis.NewLinter( 26 a.Name, 27 a.Doc, 28 []*analysis.Analyzer{a}, 29 cfg, 30 ).WithLoadMode(goanalysis.LoadModeTypesInfo) 31 }