github.com/driusan/bug@v0.3.2-0.20190306121946-d7f4e7f33fea/test.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  # Script to run go test on multiple packages with a single
     4  # coverage report for codecov.io.
     5  # You probably just want to use "go test ./..." instead of
     6  # this script
     7  set -e
     8  echo "" > coverage.txt
     9  
    10  for d in $(find ./* -maxdepth 10 -type d); do
    11      if ls $d/*.go &> /dev/null; then
    12          go test -coverprofile=profile.out -covermode=atomic $d
    13          if [ -f profile.out ]; then
    14              cat profile.out >> coverage.txt
    15              rm profile.out
    16          fi
    17      fi
    18  done