From c64946b88ccd5a32fb995d98db7a4325e690f723 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Tue, 29 Sep 2015 10:35:27 +0300 Subject: [PATCH] Inject Godeps before go get to avoid duplicate deps. --- docker/base/build.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docker/base/build.sh b/docker/base/build.sh index 18ca835..dd39f24 100644 --- a/docker/base/build.sh +++ b/docker/base/build.sh @@ -29,13 +29,20 @@ if [ "$EXT_GOPATH" != "" ]; then cd `go list -e -f {{.Dir}} $1` export GOPATH=$GOPATH:`pwd`/Godeps/_workspace else + # Inject all possible Godep paths to short circuit go gets + GOPATH_ROOT=$GOPATH/src + IMPORT_PATH=$1 + while [ "$IMPORT_PATH" != "." ]; do + export GOPATH=$GOPATH:$GOPATH_ROOT/$IMPORT_PATH/Godeps/_workspace + IMPORT_PATH=`dirname $IMPORT_PATH` + done + # Otherwise download the canonical import path (may fail, don't allow failures beyond) echo "Fetching main repository $1..." - go get -d $1 + go get -v -d $1 set -e - cd $GOPATH/src/$1 - export GOPATH=$GOPATH:`pwd`/Godeps/_workspace + cd $GOPATH_ROOT/$1 # Switch over the code-base to another checkout if requested if [ "$REPO_REMOTE" != "" ]; then