github.com/waldiirawan/apm-agent-go/v2@v2.2.2/scripts/test_coverage.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  set -e
     4  
     5  profile_out=$(mktemp)
     6  function on_exit {
     7      rm -f $profile_out
     8  }
     9  trap on_exit EXIT
    10  
    11  echo "mode: atomic"
    12  for dir in $(scripts/moduledirs.sh); do
    13      (
    14      cd $dir
    15      for pkg in $(go list ./...); do
    16          go test -coverpkg=github.com/waldiirawan/apm-agent-go/... -coverprofile=$profile_out -covermode=atomic $pkg 1>&2
    17          if [ -f $profile_out ]; then
    18              grep -v "mode: atomic" $profile_out || true
    19              rm $profile_out
    20          fi
    21      done
    22      )
    23  done