This looks awesome. I haven't tried it yet, but the hopefully it supports writing test coverage files for multiple packages, i.e. I already split the code up into separate packages and put each package in a corresponding subfolder. Using go test ./... I want to collect coverage reports for all my packages while ignoring `vendor`
So my workaround is something like the following, where I generate a coverage report for each package to later concatenate them into a final coverage report
```
for i in $(go list ./... | grep -v 'vendor')
do
coverName="$(basename $i).coverraw"
go test --ldflags '-extldflags "-static"' -v -race -coverprofile="${coverName}" "${i}" | tee -a "${test_outfile}"
done```
It is quite a bit of coverage and Makefile magic, but it generates coverage results. The same file also allows us to wire in sharness testing (cli tests) to generate coverage report. It is quite important for us as we don't test cli in unit tests just in the sharness.
Each package has its one coverage target, for each package I collect dependencies that are in our testing scope and then I create go test cover call that includes those dependencies.
It does exactly what you want, and it handles overlapping coverage blocks (if two packages have tests that run the same portion of code), which just concatenating will mess up. (It uses gocovmerge behind the scenes, but it will be hidden from you.)
So my workaround is something like the following, where I generate a coverage report for each package to later concatenate them into a final coverage report
``` for i in $(go list ./... | grep -v 'vendor') do coverName="$(basename $i).coverraw" go test --ldflags '-extldflags "-static"' -v -race -coverprofile="${coverName}" "${i}" | tee -a "${test_outfile}" done```