#!/usr/bin/env bash
set -e
out="coverage.txt"
tmp="profile.coverage.out"
except="example|testproto"
: > $out
i=0
for d in $(go list ./... | grep -v vendor); do
if [[ $d =~ $except ]]; then
continue
fi
echo -e "TESTS FOR: for \033[0;35m${d}\033[0m"
go test -v -coverprofile=$tmp $d
if [ -f $tmp ]; then
if [ "$i" != 0 ]; then
sed -i '' -e '/^mode:/d' ./$tmp
fi
cat $tmp >> $out
rm $tmp
fi
echo ""
((i++))
done