From e15ac5024a9aaaa03e1c896ed49eca31fba1082d Mon Sep 17 00:00:00 2001 From: David Hill Date: Sun, 15 Jan 2017 08:38:08 -0500 Subject: [PATCH] travis: test against latest releases. While here, clean up goclean.sh. --- .travis.yml | 5 ++--- goclean.sh | 22 ++++++++++++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index e3128e11..65aa0a9d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,10 @@ language: go go: - - 1.6.3 - - 1.7 + - 1.6.x + - 1.7.x sudo: false install: - go get -d -t -v ./... - - go get -v golang.org/x/tools/cmd/cover - go get -v github.com/alecthomas/gometalinter - gometalinter --install script: diff --git a/goclean.sh b/goclean.sh index 56268e09..3c1f084f 100755 --- a/goclean.sh +++ b/goclean.sh @@ -6,30 +6,40 @@ # 4. go vet (http://golang.org/cmd/vet) # 5. gosimple (https://github.com/dominikh/go-simple) # 6. unconvert (https://github.com/mdempsky/unconvert) -# 7. test coverage (http://blog.golang.org/cover) +# 7. race detector (http://blog.golang.org/race-detector) +# 8. test coverage (http://blog.golang.org/cover) # -# gometalinter (github.com/alecthomas/gometalinter) is used to run each each -# static checker. +# gometalinter (github.com/alecthomas/gometalinter) is used to run each static +# checker. -set -e +set -ex + +# Make sure gometalinter is installed and $GOPATH/bin is in your path. +# $ go get -v github.com/alecthomas/gometalinter" +# $ gometalinter --install" +if [ ! -x "$(type -p gometalinter)" ]; then + exit 1 +fi # Automatic checks test -z "$(gometalinter --disable-all \ --enable=gofmt \ +--enable=goimports \ --enable=golint \ --enable=vet \ --enable=gosimple \ --enable=unconvert \ ---enable=goimports \ --deadline=45s ./... | tee /dev/stderr)" env GORACE="halt_on_error=1" go test -race ./... # Run test coverage on each subdirectories and merge the coverage profile. +set +x echo "mode: count" > profile.cov # Standard go tooling behavior is to ignore dirs with leading underscores. -for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d); +for dir in $(find . -maxdepth 10 -not -path '.' -not -path './.git*' \ + -not -path '*/_*' -type d); do if ls $dir/*.go &> /dev/null; then go test -covermode=count -coverprofile=$dir/profile.tmp $dir