diff --git a/bin/check_go_path b/bin/check_go_path index 229887043..589696466 100755 --- a/bin/check_go_path +++ b/bin/check_go_path @@ -7,11 +7,6 @@ if [ -z "$PWD" ]; then exit 1 fi -if [ -z "$GOPATH" ]; then - echo "GOPATH not set, you must have go configured properly to install ipfs" - exit 1 -fi - while [ ${#} -gt 1 ]; do if [ "$PWD" = "$2" ]; then exit 0 @@ -20,5 +15,5 @@ while [ ${#} -gt 1 ]; do done echo "go-ipfs must be built from within your \$GOPATH directory." -echo "expected within '$GOPATH' but got '$PWD'" +echo "expected within '$(go env GOPATH)' but got '$PWD'" exit 1 diff --git a/mk/golang.mk b/mk/golang.mk index ebd8e19e0..26b1b2eb5 100644 --- a/mk/golang.mk +++ b/mk/golang.mk @@ -1,12 +1,16 @@ # golang utilities GO_MIN_VERSION = 1.9 + # pre-definitions GOCC ?= go GOTAGS ?= GOFLAGS ?= GOTFLAGS ?= +# match Go's default GOPATH behaviour +export GOPATH ?= $(shell $(GOCC) env GOPATH) + DEPS_GO := TEST_GO := TEST_GO_BUILD :=