github.com/stampzilla/stampzilla-go@v2.0.0-rc9+incompatible/coverage (about) 1 #!/bin/bash 2 3 set -o errexit 4 set -o pipefail 5 readonly GOPATH="${GOPATH%%:*}" 6 7 main() { 8 _cd_into_top_level 9 _generate_coverage_files 10 _combine_coverage_reports 11 } 12 13 _cd_into_top_level() { 14 cd "$(git rev-parse --show-toplevel)" 15 #cd nodes/stampzilla-server 16 } 17 18 _generate_coverage_files() { 19 for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -not -path '*/stampzilla-telldus-events' -not -path '*/stampzilla-hidcommander' -type d); do 20 if ls $dir/*.go &>/dev/null ; then 21 go test -covermode=atomic -coverprofile=$dir/profile.coverprofile $dir || fail=1 22 fi 23 done 24 } 25 26 _install_gover() { 27 if [[ ! -x "${GOPATH}/bin/gover" ]] ; then 28 go get -u github.com/modocache/gover 29 fi 30 } 31 32 _combine_coverage_reports() { 33 _install_gover 34 ${GOPATH}/bin/gover 35 mv gover.coverprofile coverage.txt 36 } 37 38 main "$@"