github.com/gophercloud/gophercloud@v1.11.0/script/coverage (about) 1 #!/bin/bash 2 3 set -e 4 5 n=1 6 for testpkg in $(go list ./testing ./.../testing); do 7 covpkg="${testpkg/"/testing"/}" 8 go test -covermode count -coverprofile "testing_"$n.coverprofile -coverpkg "$covpkg" "$testpkg" 2>/dev/null 9 n=$((n+1)) 10 done 11 12 base_pkg=$(go list) 13 # Look for additional test files 14 for path in $(find . -path '*/testing' -prune -o -path '*/internal' -prune -o -name '*_test.go' -exec dirname {} \; | uniq); do 15 pkg="${base_pkg}${path:1}" 16 go test -covermode count -coverprofile "testing_"$n.coverprofile -coverpkg "$pkg" "$pkg" 2>/dev/null 17 n=$((n+1)) 18 done 19 20 gocovmerge `ls *.coverprofile` > cover.out 21 rm ./*.coverprofile