-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·44 lines (36 loc) · 898 Bytes
/
build.sh
File metadata and controls
executable file
·44 lines (36 loc) · 898 Bytes
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
#!/bin/bash -e
PROJECT="${PROJECT:-$(basename $PWD)}"
ORG_PATH="github.com/shutterstock"
REPO_PATH="${ORG_PATH}/${PROJECT}"
export GOPATH=${PWD}/gopath
export PATH="$GOPATH/bin:$PATH"
rm -f $GOPATH/src/${REPO_PATH}
mkdir -p $GOPATH/src/${ORG_PATH}
ln -s ${PWD} $GOPATH/src/${REPO_PATH}
eval $(go env)
go get golang.org/x/tools/cmd/cover
if [ -s DEPENDENCIES ]; then
for d in $(cat DEPENDENCIES); do
go get $d
done
fi
# set flags
[ "$DEBUG" == 'true' ] || GOFLAGS="-ldflags '-s'"
# build it!
for pkg in *util; do
if [ -d $pkg ]; then
case $1 in
test)
CGO_ENABLED=0 go test -test.v -coverprofile $pkg-profile.file -a $GOFLAGS ${REPO_PATH}/$pkg
;;
coverage)
for i in *.file; do
go tool cover --html $i -o $(basename $i .file).html
done
;;
*)
CGO_ENABLED=0 go build -a $GOFLAGS ${REPO_PATH}/$pkg
;;
esac
fi
done