Add golangci mage target

This commit is contained in:
kolaente 2020-10-11 18:16:34 +02:00
parent d56a611be7
commit 8bbdab7cfa
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 10 additions and 0 deletions

View File

@ -434,6 +434,16 @@ func (Check) Goconst() {
runAndStreamOutput("goconst", ApiPackages...)
}
func (Check) Golangci() {
mg.Deps(initVars)
if err := exec.Command("golangci-lint").Run(); err != nil && strings.Contains(err.Error(), "executable file not found") {
fmt.Println("Please manually install golangci-lint by running")
fmt.Println("curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.31.0")
os.Exit(1)
}
runAndStreamOutput("golangci-lint", "run")
}
// Runs fmt-check, lint, got-swag, misspell-check, ineffasign-check, gocyclo-check, static-check, gosec-check, goconst-check all in parallel
func (Check) All() {
mg.Deps(initVars)