github.com/ryanbennettvoid/go-swagger@v0.18.1-0.20190104015444-3854bbbe2392/hack/cover.sh (about) 1 #!/bin/bash 2 3 set -e -o pipefail 4 5 workdir=cover 6 profile="$workdir/cover.out" 7 mode=${GOCOVMODE-atomic} 8 9 # Run test coverage on each subdirectories and merge the coverage profile. 10 echo "mode: $mode" > "$profile" 11 12 # Standard go tooling behavior is to ignore dirs with leading underscores 13 for dir in $(go list ./... | grep -v -E 'vendor|fixtures|examples') 14 do 15 f="$workdir/$(echo "$dir" | tr / -).cover" 16 go test -vet off -tags netgo -installsuffix netgo -covermode="$mode" -coverprofile="$f" "$dir" 17 if [ -f "$f" ] 18 then 19 cat "$f" | tail -n +2 >> "$profile" 20 rm "$f" 21 fi 22 done 23 24 go tool cover -func "$profile" 25 gocov convert "$profile" | gocov report 26 gocov convert "$profile" | gocov-html > "$workdir/coverage.html"