No Description

test.sh 466B

1234567891011121314151617181920212223242526
  1. #!/usr/bin/env bash
  2. set -e
  3. set -x
  4. MODE=atomic
  5. echo "mode: $MODE" > coverage.txt
  6. # All packages.
  7. PKG=$(go list ./...)
  8. staticcheck $PKG
  9. unused $PKG
  10. # Packages that have any tests.
  11. PKG=$(go list -f '{{if .TestGoFiles}} {{.ImportPath}} {{end}}' ./...)
  12. go test -v $PKG
  13. for d in $PKG; do
  14. go test -race -coverprofile=profile.out -covermode=$MODE $d
  15. if [ -f profile.out ]; then
  16. cat profile.out | grep -v "^mode: " >> coverage.txt
  17. rm profile.out
  18. fi
  19. done