Files
docker-docs/coverpkg.sh
Ying Li 408f1efee7 Use -coverpkg to build multiple coverage outputs and use a tool
to merge them, to get more complete coverage information (so a package
can be tested by code outside the package).

Signed-off-by: Ying Li <ying.li@docker.com>
2015-10-24 02:31:09 -07:00

11 lines
407 B
Bash
Executable File

#!/usr/bin/env bash
# Given a subpackage and the containing package, figures out which packages
# need to be passed to `go test -coverpkg`: this includes all of the
# subpackage's dependencies within the containing package, as well as the
# subpackage itself.
DEPENDENCIES="$(go list -f $'{{range $f := .Deps}}{{$f}}\n{{end}}' ${1} | grep ${2})"
echo "${1} ${DEPENDENCIES}" | xargs echo -n | tr ' ' ','