Skip to content

Instantly share code, notes, and snippets.

@skarllot
Created May 3, 2016 21:24
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save skarllot/13ebe8220822bc19494c8b076aabe9fc to your computer and use it in GitHub Desktop.
Save skarllot/13ebe8220822bc19494c8b076aabe9fc to your computer and use it in GitHub Desktop.
Makefile to merge coverage data from all subpackages (Golang)
.PHONY: test-cover-html
PACKAGES = $(shell find ./ -type d -not -path '*/\.*')
test-cover-html:
echo "mode: count" > coverage-all.out
$(foreach pkg,$(PACKAGES),\
go test -coverprofile=coverage.out -covermode=count $(pkg);\
tail -n +2 coverage.out >> coverage-all.out;)
go tool cover -html=coverage-all.out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment