diff --git a/.travis.yml b/.travis.yml index fbf149ca..1bc95ca1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,8 +13,8 @@ install: - go get github.com/mattn/goveralls script: - go build -- go fmt ./... -- go vet ./... +- ./travis/gofmt.sh +- ./travis/govet.sh - go test -i -race ./... - go test -v -race ./... - ./travis/coveralls-script.sh diff --git a/travis/gofmt.sh b/travis/gofmt.sh new file mode 100755 index 00000000..03931943 --- /dev/null +++ b/travis/gofmt.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# run go fmt and exit non-zero if it detected anything +T=$(mktemp -t gofmt.XXXXX) +go fmt ./... > $T +if egrep -q '.*' "$T" ; then + echo "go fmt failed on the following files:" + cat "$T" + rm $T + exit 1 +fi +rm $T +exit 0 diff --git a/travis/govet.sh b/travis/govet.sh new file mode 100755 index 00000000..0c38d347 --- /dev/null +++ b/travis/govet.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# run go vet and exit non-zero if it detected anything +T=$(mktemp -t govet.XXXXX) +go vet ./... > $T +if egrep -q '.*' "$T" ; then + echo "go vet failed on the following files:" + cat "$T" + rm $T + exit 1 +fi +rm $T +exit 0