forked from coreos/ignition
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest
executable file
·42 lines (32 loc) · 811 Bytes
/
test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash
set -eu
source ./build
SRC=$(find . -name '*.go' \
-not -path "./internal/vendor/*" \
-not -path "./config/vendor/*" \
-not -path "./config/v1/vendor/*")
PKG=$(cd gopath/src/${REPO_PATH}; go list ./... | \
grep --invert-match vendor)
# https://github.com/golang/go/issues/15067
PKG_VET=$(cd gopath/src/${REPO_PATH}; go list ./... | \
grep --invert-match vendor | \
grep --invert-match internal/log)
echo "Checking gofix..."
go tool fix -diff $SRC
echo "Checking gofmt..."
res=$(gofmt -d -e -s $SRC)
echo "${res}"
if [ -n "${res}" ]; then
exit 1
fi
echo "Checking govet..."
go vet $PKG_VET
echo "Running tests..."
if [ "${ACTION:-TEST}" != "COMPILE" ]; then
go test -timeout 60s -run -cover $@ ${PKG} --race
else
for p in ${PKG}; do
go test -c $p
done
fi
echo "Success"