Skip to content

Instantly share code, notes, and snippets.

@ReanGD
Created June 12, 2016 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ReanGD/fd375ab93ae3fff381258f4455c68e59 to your computer and use it in GitHub Desktop.
Save ReanGD/fd375ab93ae3fff381258f4455c68e59 to your computer and use it in GitHub Desktop.
Travis go test
#!/usr/bin/env bash
set -e
# We truncate the whole file because we are going to put new coverage data into
# it. Note that using "echo '' > file" would cause new lines which some
# coverage uploader do not like.
> coverage.txt
for d in $(find ./* -maxdepth 10 -type f -name '*test.go' -not -path "./.git/*" -exec dirname {} \; | sort -u); do
go test -covermode=atomic -coverprofile=profile.out $d
if [ -f profile.out ]; then
cat profile.out >> coverage.txt
rm profile.out
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment