...

Text file src/github.com/shirou/gopsutil/coverall.sh

Documentation: github.com/shirou/gopsutil

     1#!/bin/sh
     2
     3# see http://www.songmu.jp/riji/entry/2015-01-15-goveralls-multi-package.html
     4
     5set -e
     6# cleanup
     7cleanup() {
     8  if [ "$tmpprof" != "" ] && [ -f "$tmpprof" ]; then
     9    rm -f "$tmpprof"
    10  fi
    11  exit
    12}
    13trap cleanup INT QUIT TERM EXIT
    14
    15# メインの処理
    16prof=${1:-".profile.cov"}
    17echo "mode: count" > "$prof"
    18gopath1=$(echo "$GOPATH" | cut -d: -f1)
    19for pkg in $(go list ./...); do
    20  tmpprof="$gopath1/src/$pkg/profile.tmp"
    21  go test -covermode=count -coverprofile="$tmpprof" "$pkg"
    22  if [ -f "$tmpprof" ]; then
    23    tail -n +2 "$tmpprof" >> "$prof"
    24    rm "$tmpprof"
    25  fi
    26done

View as plain text