-
Notifications
You must be signed in to change notification settings - Fork 0
/
compileall.sh
executable file
·48 lines (40 loc) · 1.01 KB
/
compileall.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
GOversion=1.14
go tool dist list >/dev/null || {
echo 1>&2 "go tool dist list not supported - can't check compile"
exit 0
}
failures=0
function compile {
osarch=$1
parts=(${osarch//\// })
export GOOS=${parts[0]}
export GOARCH=${parts[1]}
if go tool compile -V >/dev/null 2>&1 ; then
echo Try GOOS=${GOOS} GOARCH=${GOARCH}
if ! sudo docker run --rm \
-v "$PWD":/usr/src/myapp \
-w /usr/src/myapp \
-e GOOS=$GOOS \
-e GOARCH=$GOARCH golang:$GOversion /usr/src/myapp/compile1.sh; then
echo "*** Failed compiling GOOS=${GOOS} GOARCH=${GOARCH}"
failures=$((failures+1))
fi
else
echo Skipping GOOS=${GOOS} GOARCH=${GOARCH} as not supported
fi
}
go fmt
if [ "$1x" != "qx" ]; then
while read -r line; do
compile $line
done < <(go tool dist list)
else
compile linux/amd64
compile darwin/amd64
compile windows/amd64
fi
if [ $failures -ne 0 ]; then
echo "*** $failures compile failures"
exit 1
fi