From ff75bc0318579fa743a35d316c61d2f8c4ab92ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Sun, 5 Jun 2016 19:53:47 +0300 Subject: [PATCH] Makefile, bin: Support multiple GOPATH components MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit License: MIT Signed-off-by: Péter Szilágyi --- Makefile | 2 +- bin/check_go_path | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 81a33e37283..f68dee72c40 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ bin/gx-go-v%: gx_check: ${gx_bin} ${gx-go_bin} path_check: - @bin/check_go_path $(realpath $(shell pwd)) $(realpath $(GOPATH)/src/github.com/ipfs/go-ipfs) + @bin/check_go_path $(realpath $(shell pwd)) $(realpath $(addsuffix /src/github.com/ipfs/go-ipfs,$(subst :, ,$(GOPATH)))) deps: go_check gx_check path_check ${gx_bin} --verbose install --global diff --git a/bin/check_go_path b/bin/check_go_path index b34660e3cd4..22988704376 100755 --- a/bin/check_go_path +++ b/bin/check_go_path @@ -1,7 +1,6 @@ #!/bin/sh PWD=$1 -EXPECTED=$2 if [ -z "$PWD" ]; then echo "must pass in your current working directory" @@ -13,8 +12,13 @@ if [ -z "$GOPATH" ]; then exit 1 fi -if [ "$PWD" != "$EXPECTED" ]; then - echo "go-ipfs must be built from within your \$GOPATH directory." - echo "expected '$EXPECTED' but got '$PWD'" - exit 1 -fi +while [ ${#} -gt 1 ]; do + if [ "$PWD" = "$2" ]; then + exit 0 + fi + shift +done + +echo "go-ipfs must be built from within your \$GOPATH directory." +echo "expected within '$GOPATH' but got '$PWD'" +exit 1