mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-13 12:06:29 +00:00
34 lines
610 B
Go
34 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)
|
||
|
}
|