Skip to content

Commit

Permalink
fine tune the -coverpkg settings, so that we don’t get any warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mpgerlek committed Apr 20, 2018
1 parent ead8f73 commit 0b552e1
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions ci/go_test_multi_package_coverprofile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,23 @@ coverprofile="$workdir/$coverprofilename.coverprofile"
# Sets -cover.
mode=count

function join { local IFS="$1"; shift; echo "$*"; }
mypkgs=`go list ./...`
mypkgs=`join , $mypkgs`

# functions section
generate_cover_data() {
rm -rf "$workdir"
mkdir "$workdir"

for pkg in "$@"; do

# Make a list of each proj-related package we depend on (plus ourself).
# We will collect coverage stats on all those packages, not just ourself,
# so that we can get coverage data across package boundaries.
mypkgs=$pkg
for i in `go list -f '{{.Deps}}' $pkg` ; do
if [[ "$i" = "github.com/go-spatial/proj"* ]]; then
mypkgs="$mypkgs,$i"
fi
done

f="$workdir/$(echo $pkg | tr / -).pkgcoverprofile"
go test -covermode="$mode" -coverprofile="$f" -coverpkg=$mypkgs "$pkg"
done
Expand Down

0 comments on commit 0b552e1

Please sign in to comment.