mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-14 04:26:32 +00:00
24 lines
657 B
Go
24 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...)
|
||
|
})
|
||
|
}
|