diff --git a/.travis.yml b/.travis.yml index b91f63bd..65362ead 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ before_install: - go get -t -v ./... script: - - ./go.test.sh + - ./go.coverage.sh - gometalinter --disable-all --enable=errcheck --enable=vet --enable=vetshadow --enable=megacheck --exclude=S1024 # TODO: remove exclude when we stop support Go 1.7 and lower - gometalinter --disable-all --enable=errcheck --enable=vet --enable=vetshadow --enable=megacheck --exclude=U1000 examples/... # the way examples are structured produces unused functions - gometalinter --disable-all --enable=errcheck --enable=vet --enable=vetshadow --enable=megacheck helpers/... diff --git a/go.coverage.sh b/go.coverage.sh new file mode 100755 index 00000000..fadb3cc8 --- /dev/null +++ b/go.coverage.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -e +echo > coverage.txt + +for d in $(go list ./... | grep -v -E '/vendor|/examples|/docker'); do + go test -coverprofile=profile.out -covermode=atomic "$d" + if [ -f profile.out ]; then + cat profile.out >> coverage.txt + rm profile.out + fi +done diff --git a/go.test.sh b/go.test.sh index 784dbee5..ddae208c 100755 --- a/go.test.sh +++ b/go.test.sh @@ -1,12 +1,7 @@ #!/usr/bin/env bash set -e -echo > coverage.txt for d in $(go list ./... | grep -v -E '/vendor|/examples|/docker'); do - go test -race -coverprofile=profile.out -covermode=atomic $d - if [ -f profile.out ]; then - cat profile.out >> coverage.txt - rm profile.out - fi + go test -race "$d" done