Created
December 22, 2016 13:26
-
-
Save achilleas-k/311e8904c96ba1d8edf5a2f5d96666f1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
# exit on error | |
set -e | |
# run go test in each package that contains test files (once per package only) | |
find -iname "*test.go" -execdir [ ! -e covprof.part ] \; -execdir go test -v -covermode=count -coverprofile=covprof.part \; | |
# prepare global coverage profile | |
echo "mode: count" > profile.cov | |
# join parts (filter header lines) | |
grep -h -v -F "mode: count" --include=covprof.part -r . >> profile.cov | |
# generate html report thingie | |
go tool cover -html=profile.cov | |
# cleanup | |
find -name "covprof.part" -exec rm {} \; | |
rm profile.cov |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment