Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment