forked from mirror/logrus
migrate lint script to a mage target
This commit is contained in:
parent
4b818a50d4
commit
b02b418f8f
|
@ -10,7 +10,7 @@ install:
|
||||||
- ./travis/install.sh
|
- ./travis/install.sh
|
||||||
script:
|
script:
|
||||||
- go run mage.go -v crossBuild
|
- go run mage.go -v crossBuild
|
||||||
- ./travis/lint.sh
|
- go run mage.go lint
|
||||||
- export GOMAXPROCS=4
|
- export GOMAXPROCS=4
|
||||||
- export GORACE=halt_on_error=1
|
- export GORACE=halt_on_error=1
|
||||||
- go test -race -v ./...
|
- go test -race -v ./...
|
||||||
|
|
11
magefile.go
11
magefile.go
|
@ -5,6 +5,8 @@ package main
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
|
||||||
"github.com/magefile/mage/mg"
|
"github.com/magefile/mage/mg"
|
||||||
"github.com/magefile/mage/sh"
|
"github.com/magefile/mage/sh"
|
||||||
|
@ -58,3 +60,12 @@ func CrossBuild() error {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Lint() error {
|
||||||
|
gopath := os.Getenv("GOPATH")
|
||||||
|
if gopath == "" {
|
||||||
|
return fmt.Errorf("cannot retrieve GOPATH")
|
||||||
|
}
|
||||||
|
|
||||||
|
return sh.Run(path.Join(gopath, "bin", "golangci-lint"), "run", "./...")
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [[ "$TRAVIS_GO_VERSION" =~ ^1\.15\. ]] && [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$GO111MODULE" == "on" ]]; then
|
|
||||||
$(go env GOPATH)/bin/golangci-lint run ./...
|
|
||||||
else
|
|
||||||
echo "linter has not been run"
|
|
||||||
fi
|
|
Loading…
Reference in New Issue