forked from brimstone/docker-golang
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathloader
executable file
·53 lines (46 loc) · 917 Bytes
/
loader
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
49
50
51
52
53
#!/bin/sh
set -ue
if [ -n "${1:-}" ]; then
exec "$@"
fi
LDFLAGS="${LDFLAGS:-}"
CGO_CFLAGS="${CGO_CFLAGS:--g -O2}"
CGO_LDFLAGS="${CGO_LDFLAGS:--g -O2}"
CGO_CXXFLAGS="${CGO_LDFLAGS:--g -O2}"
X=""
if [ -n "$VERBOSE" ]; then
set -x
X="-x"
fi
if [ "$#" = 0 ]; then
echo "Assuming the working directory contains source files." >&2
fi
if [ -n "$TAR" ]; then
tar -x >&2
(
[ -n "${1:-}" ] && [ -d "src/$1" ] && cd "src/$1"
/usr/local/go/bin/go get -v -d >&2
)
fi
export CGO_CFLAGS
export CGO_LDFLAGS="$CGO_LDFLAGS"
(
echo "CC=${CC:-}"
echo "CGO_CFLAGS=$CGO_CFLAGS"
echo "CGO_CXXFLAGS=$CGO_CXXFLAGS"
echo "CGO_ENABLED=$CGO_ENABLED"
echo "CGO_LDFLAGS=$CGO_LDFLAGS"
echo "GOARCH=$GOARCH"
echo "LDFLAGS=$LDFLAGS"
echo "PWD=$PWD"
echo Running /bin/go build -v $X "$@"
) >&2
ret=0
/bin/go build -v $X "$@" >&2 || ret=$?
if [ $ret != 0 ]; then
echo "Exit: $ret" >&2
exit $ret
fi
if [ -n "$TAR" ]; then
tar -c .
fi