Created
December 16, 2016 21:37
-
-
Save toefel18/77dcdf892b35dcb955ececc784dbd91f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
# clear coverage.out | |
cp /dev/null coverage.out | |
for d in $(go list ./... | grep -v vendor); do | |
go test -race -coverprofile=profile.out -covermode=atomic $d | |
if [ -f profile.out ]; then | |
cat profile.out >> coverage.out | |
rm profile.out | |
fi | |
done | |
# remove duplicate lines (mode: count is present in each package) | |
awk '!a[$0]++' coverage.out > cover-profile.out | |
go tool cover -html=cover-profile.out -o coverage.html | |
rm coverage.out cover-profile.out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script creates a single HTML file with the coverage of your project, per source file.