woodpecker/vendor/github.com/golangci/golangci-lint/pkg/golinters/tenv.go
2021-11-16 21:07:53 +01:00

33 lines
610 B
Go

package golinters
import (
"github.com/sivchari/tenv"
"golang.org/x/tools/go/analysis"
"github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
)
func NewTenv(settings *config.TenvSettings) *goanalysis.Linter {
a := tenv.Analyzer
analyzers := []*analysis.Analyzer{
a,
}
var cfg map[string]map[string]interface{}
if settings != nil {
cfg = map[string]map[string]interface{}{
a.Name: {
tenv.A: settings.All,
},
}
}
return goanalysis.NewLinter(
a.Name,
a.Doc,
analyzers,
cfg,
).WithLoadMode(goanalysis.LoadModeSyntax)
}