golangci-lint/pkg/golinters/testpackage.go
dependabot[bot] 3a0f646e31
build(deps): bump github.com/maratori/testpackage from 1.0.1 to 1.1.0 (#2945)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2022-06-28 14:44:44 +02:00

29 lines
745 B
Go

package golinters
import (
"strings"
"github.com/maratori/testpackage/pkg/testpackage"
"golang.org/x/tools/go/analysis"
"github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
)
func NewTestpackage(cfg *config.TestpackageSettings) *goanalysis.Linter {
var a = testpackage.NewAnalyzer()
var settings map[string]map[string]interface{}
if cfg != nil {
settings = map[string]map[string]interface{}{
a.Name: {
testpackage.SkipRegexpFlagName: cfg.SkipRegexp,
testpackage.AllowPackagesFlagName: strings.Join(cfg.AllowPackages, ","),
},
}
}
return goanalysis.NewLinter(a.Name, a.Doc, []*analysis.Analyzer{a}, settings).
WithLoadMode(goanalysis.LoadModeSyntax)
}