unit testing - How to get all packages' code coverage together in Go? -


i have library consisting of several packages. when running tests, using '-cover' flag , showing coverage information each package individually.like follows:

--- pass: testsampletestsuite (0.00s) pass coverage: 28.7% of statements ok      github.com/path/to/package1 13.021s ?       github.com/path/to/package2 [no test files]  === run   testabc --- pass: testabc (0.43s) pass coverage: 27.7% of statements 

is there way full coverage overview idea coverage on whole project?

update: here go test command using

go test ./... -v -short -p 1 -cover 

here bash script extracted https://github.com/h12w/gosweep :

#!/bin/bash set -e dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d); if ls $dir/*.go &> /dev/null;     go test -short -covermode=count -coverprofile=$dir/profile.tmp $dir     if [ -f $dir/profile.tmp ]             cat $dir/profile.tmp | tail -n +2 >> profile.cov         rm $dir/profile.tmp     fi fi done  go tool cover -func profile.cov 

Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -