travis: move format checks earlier and use goimports
@@ -8,8 +8,10 @@ go:
- 1.7.x
- 1.8.x
-# Required for coverage.
before_install:
+ # Required for format check.
+ - go get golang.org/x/tools/cmd/goimports
+ # Required for coverage.
- go get golang.org/x/tools/cmd/cover
- go get github.com/mattn/goveralls
@@ -18,14 +20,14 @@ go_import_path: gonum.org/v1/gonum
# Get deps, build, test, and ensure the code is gofmt'ed.
# If we are building as gonum, then we have access to the coveralls api key, so we can run coverage as well.
script:
+ - test -z "$(goimports -d .)"
+ - if [[ -n "$(gofmt -s -l .)" ]]; then echo -e '\e[31mCode not gofmt simplified in:\n\n'; gofmt -s -l .; echo -e "\e[0"; fi
- go get -d -t -v ./...
- go build -v ./...
- go test -v ./...
- go test -a -tags bounds -x -v ./...
- go test -a -tags noasm -x -v ./...
- go test -a -tags appengine -x -v ./...
- - test -z "$(gofmt -d .)"
- - if [[ -n "$(gofmt -s -l .)" ]]; then echo -e '\e[31mCode not gofmt simplified in:\n\n'; gofmt -s -l .; echo -e "\e[0"; fi
- if [[ $TRAVIS_SECURE_ENV_VARS = "true" ]]; then bash ./.travis/test-coverage.sh; fi
# This is run last since it alters the tree.
- ${TRAVIS_BUILD_DIR}/.travis/check-generate.sh
