From 1e3a71d098e3317ef36c6aaa40ddfb3a42952bab Mon Sep 17 00:00:00 2001 From: Anthony Romano Date: Tue, 27 Sep 2016 10:18:25 -0700 Subject: [PATCH] build: support building out of path when GOPATH is not set Otherwise gets "go: GOPATH entry is relative; must be absolute path: ""." --- .travis.yml | 2 +- build | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9da9ef8dfd5..d0a784f240c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,6 +55,6 @@ script: ;; *) # test building out of gopath - GO_BUILD_FLAGS="-a -v" GOPATH=/bad-go-path GOARCH="${TARGET}" ./build + GO_BUILD_FLAGS="-a -v" GOPATH="" GOARCH="${TARGET}" ./build ;; esac diff --git a/build b/build index 9143ca1024e..db9022f4f23 100755 --- a/build +++ b/build @@ -40,7 +40,10 @@ etcd_setup_gopath() { cd "$CDIR" etcdGOPATH=${CDIR}/gopath # preserve old gopath to support building with unvendored tooling deps (e.g., gofail) - export GOPATH=${etcdGOPATH}:$GOPATH + if [ -n "$GOPATH" ]; then + GOPATH=":$GOPATH" + fi + export GOPATH=${etcdGOPATH}$GOPATH rm -f ${etcdGOPATH}/src mkdir -p ${etcdGOPATH} ln -s ${CDIR}/cmd/vendor ${etcdGOPATH}/src