Skip to content

Instantly share code, notes, and snippets.

@poying
Created November 12, 2017 04:44
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 poying/e7bde96e3120b924676c09aaf40ce487 to your computer and use it in GitHub Desktop.
Save poying/e7bde96e3120b924676c09aaf40ce487 to your computer and use it in GitHub Desktop.
Test script for Go project
#!/usr/bin/env bash
set -e
echo "mode: atomic" > coverage.txt
for d in $(go list ./... | grep -v vendor); do
go test -race -timeout=5s -coverprofile=profile.out -coverpkg=./... -covermode=atomic $d
if [ -f profile.out ]; then
cat profile.out | grep -v '^mode' >> 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