woodpecker/vendor/github.com/golangci/golangci-lint/pkg/golinters/rowerrcheck.go
Lukas c28f7cb29f
Add golangci-lint (#502)
Initial part of #435
2021-11-14 21:01:54 +01:00

23 lines
657 B
Go

package golinters
import (
"github.com/jingyugao/rowserrcheck/passes/rowserr"
"golang.org/x/tools/go/analysis"
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
"github.com/golangci/golangci-lint/pkg/lint/linter"
)
func NewRowsErrCheck() *goanalysis.Linter {
analyzer := rowserr.NewAnalyzer()
return goanalysis.NewLinter(
"rowserrcheck",
"checks whether Err of rows is checked successfully",
[]*analysis.Analyzer{analyzer},
nil,
).WithLoadMode(goanalysis.LoadModeTypesInfo).
WithContextSetter(func(lintCtx *linter.Context) {
pkgs := lintCtx.Settings().RowsErrCheck.Packages
analyzer.Run = rowserr.NewRun(pkgs...)
})
}