forked from nsqio/nsq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·30 lines (25 loc) · 835 Bytes
/
test.sh
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
#!/bin/sh
set -e
GOMAXPROCS=1 go test -timeout 90s ./...
if [ "$GOARCH" = "amd64" ] || [ "$GOARCH" = "arm64" ]; then
# go test: -race is only supported on linux/amd64, linux/ppc64le,
# linux/arm64, freebsd/amd64, netbsd/amd64, darwin/amd64 and windows/amd64
GOMAXPROCS=4 go test -timeout 90s -race ./...
fi
# no tests, but a build is something
for dir in apps/*/ bench/*/; do
dir=${dir%/}
if grep -q '^package main$' $dir/*.go 2>/dev/null; then
echo "building $dir"
go build -o $dir/$(basename $dir) ./$dir
else
echo "(skipped $dir)"
fi
done
# disable "composite literal uses unkeyed fields"
go vet -composites=false ./...
FMTDIFF="$(find apps internal nsqd nsqlookupd -name '*.go' -exec gofmt -d '{}' ';')"
if [ -n "$FMTDIFF" ]; then
printf '%s\n' "$FMTDIFF"
exit 1
fi