@cryptotaxi247 / kubo / commits / 439b0e35d

fix check_go_path when it has spaces in it

fixes #5260 License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>

Steven Allen committed Jul 18, 2018 at 17:08 UTC 439b0e35dcaed92828fad6620f5a79f78580dd5d
2 files changed +11 -12
bin/check_go_path
+10 -11
@@ -1,19 +1,18 @@
1 #!/bin/sh
2
3 -PWD=$1
3 +set -e
4
5 -if [ -z "$PWD" ]; then
6 - echo "must pass in your current working directory"
7 - exit 1
8 -fi
5 +PKG="$1"
6
10 -while [ ${#} -gt 1 ]; do
11 - if [ "$PWD" = "$2" ]; then
12 - exit 0
13 - fi
14 - shift
7 +PWD="$(realpath "$(pwd)")"
8 +GOPATH="$(go env GOPATH)"
9 +
10 +for p in IFS=: "${GOPATH}"; do
11 + if [ "$PWD" = "$(realpath "$p")/src/$PKG" ]; then
12 + exit 0
13 + fi
14 done
15
16 echo "go-ipfs must be built from within your \$GOPATH directory."
18 -echo "expected within '$(go env GOPATH)' but got '$PWD'"
17 +echo "expected within '$GOPATH' but got '$PWD'"
18 exit 1
mk/golang.mk
+1 -1
@@ -66,7 +66,7 @@ check_go_version:
66 DEPS_GO += check_go_version
67
68 check_go_path:
69 - bin/check_go_path $(realpath $(shell pwd)) $(realpath $(addsuffix /src/github.com/ipfs/go-ipfs,$(subst $(PATH_SEP),$(space),$(GOPATH))))
69 + GOPATH="$(GOPATH)" bin/check_go_path github.com/ipfs/go-ipfs
70 .PHONY: check_go_path
71 DEPS_GO += check_go_path
72