Import atomic package

The code is the same as github.com/uber/tchannel-go/atomic
This commit is contained in:
Prashant Varanasi
2016-05-25 10:51:13 -07:00
parent d53d39b5b9
commit 928a9d776b
10 changed files with 509 additions and 0 deletions

40
scripts/cover.sh Executable file
View File

@@ -0,0 +1,40 @@
#!/bin/bash
set -e
COVER=cover
ROOT_PKG=github.com/uber-go/atomic
if [[ -d "$COVER" ]]; then
rm -rf "$COVER"
fi
mkdir -p "$COVER"
i=0
for pkg in "$@"; do
i=$((i + 1))
extracoverpkg=""
if [[ -f "$GOPATH/src/$pkg/.extra-coverpkg" ]]; then
extracoverpkg=$( \
sed -e "s|^|$pkg/|g" < "$GOPATH/src/$pkg/.extra-coverpkg" \
| tr '\n' ',')
fi
coverpkg=$(go list -json "$pkg" | jq -r '
.Deps
| map(select(startswith("'"$ROOT_PKG"'")))
| map(select(contains("/vendor/") | not))
| . + ["'"$pkg"'"]
| join(",")
')
if [[ -n "$extracoverpkg" ]]; then
coverpkg="$extracoverpkg$coverpkg"
fi
go test \
-coverprofile "$COVER/cover.${i}.out" -coverpkg "$coverpkg" \
-v "$pkg"
done
gocovmerge "$COVER"/*.out > cover.out