Merge pull request #6532 from heyitsanthony/no-gopath-build

build: support building out of path when GOPATH is not set
This commit is contained in:
Anthony Romano 2016-09-27 13:25:04 -07:00 committed by GitHub
commit e68cd086ee
2 changed files with 5 additions and 2 deletions

View File

@ -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

5
build
View File

@ -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