Skip to content

Commit 9d18198

Browse files
author
Francisco Souza
committed
bin/build: speed-up local build time
In case we have GOPATH defined, we probably have the dependencies, than we don't need to download them again. It still works as expected in a box with no GOPATH defined. It's way faster to avoid downloading the dependencies. This is because `go get` is dumb when cloning Git repositories. This should probably change when golang/go#13078 is fixed (Go 1.7, hopefully).
1 parent 9f16f05 commit 9d18198

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

bin/build

+6-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ export CODE=$GOTMP/src/github.com/nytm/video-transcoding-api
1717
mkdir -p $CODE
1818
cp -R . $CODE
1919

20+
if [ -z "$GOPATH" ]; then
21+
export GOPATH=$GOTMP
22+
fi
23+
2024
# Download dependencies and build
2125
pushd $CODE
22-
GOPATH=$GOTMP go get -d
23-
GOPATH=$GOTMP GOARCH=amd64 GOOS=linux go build -o $OUTPUT/video-transcoding-api
26+
go get -d
27+
GOARCH=amd64 GOOS=linux go build -o $OUTPUT/video-transcoding-api
2428
cp config.json $OUTPUT/.
2529
cp swagger.json $OUTPUT/.
2630
popd

0 commit comments

Comments
 (0)