Skip to content

Commit

Permalink
don't use -race with coverage, don't cover with -race
Browse files Browse the repository at this point in the history
given the way we present output, we are redundantly running tests with
-race, which will make tests run unnecessarily longer, especially for
older versions of Go.
  • Loading branch information
extemporalgenome committed Nov 1, 2018
1 parent b3edf74 commit e6c23d8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/...
Expand Down
12 changes: 12 additions & 0 deletions go.coverage.sh
Original file line number Diff line number Diff line change
@@ -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
7 changes: 1 addition & 6 deletions go.test.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e6c23d8

Please sign in to comment.