coverpkg.sh 452 B

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