Skip to content

Instantly share code, notes, and snippets.

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