Skip to content

Instantly share code, notes, and snippets.

@tobbbles
Last active February 22, 2017 17:39
Show Gist options
  • Select an option

  • Save tobbbles/a35ee9b9dbaebcf17d8670f3688e602c to your computer and use it in GitHub Desktop.

Select an option

Save tobbbles/a35ee9b9dbaebcf17d8670f3688e602c to your computer and use it in GitHub Desktop.
workdir=.cover
profile="coverage.out"
mode=count
rm -rf "$workdir"
mkdir "$workdir"
for pkg in $(go list ./... | grep -v vendor/); do
f="$workdir/$(echo $pkg | tr / -).cover"
go test -covermode="$mode" -coverprofile="$f" "$pkg"
done
echo "mode: $mode" >"$profile"
grep -h -v "^mode:" "$workdir"/*.cover >>"$profile"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment