github.com/elek/golangci-lint@v1.42.2-0.20211208090441-c05b7fcb3a9a/pkg/golinters/testpackage.go (about)

     1  package golinters
     2  
     3  import (
     4  	"github.com/maratori/testpackage/pkg/testpackage"
     5  	"golang.org/x/tools/go/analysis"
     6  
     7  	"github.com/elek/golangci-lint/pkg/config"
     8  	"github.com/elek/golangci-lint/pkg/golinters/goanalysis"
     9  )
    10  
    11  func NewTestpackage(cfg *config.TestpackageSettings) *goanalysis.Linter {
    12  	var a = testpackage.NewAnalyzer()
    13  	var settings map[string]map[string]interface{}
    14  	if cfg != nil {
    15  		settings = map[string]map[string]interface{}{
    16  			a.Name: {
    17  				testpackage.SkipRegexpFlagName: cfg.SkipRegexp,
    18  			},
    19  		}
    20  	}
    21  	return goanalysis.NewLinter(a.Name, a.Doc, []*analysis.Analyzer{a}, settings).
    22  		WithLoadMode(goanalysis.LoadModeSyntax)
    23  }