@cryptotaxi247 / kubo / commits / 5ac752f1f

avoid realpath in check_go_path

It doesn't exist on all operating systems. License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>

Steven Allen committed Jul 18, 2018 at 19:05 UTC 5ac752f1fbc2e429d7917276d0fc36b96393a83a
1 file changed +10 -5
bin/check_go_path
+10 -5
@@ -4,15 +4,20 @@ set -e
4
5 PKG="$1"
6
7 -PWD="$(realpath "$(pwd)")"
7 +DIR="$(pwd -P)"
8 GOPATH="$(go env GOPATH)"
9
10 -for p in IFS=: "${GOPATH}"; do
11 - if [ "$PWD" = "$(realpath "$p")/src/$PKG" ]; then
10 +while read -d ':' p; do
11 + if ! cd "$p/src/$PKG" 2>/dev/null; then
12 + continue
13 + fi
14 +
15 + if [ "$DIR" = "$(pwd -P)" ]; then
16 exit 0
17 fi
14 -done
18 + cd "$DIR"
19 +done <<< "$GOPATH:"
20
21 echo "go-ipfs must be built from within your \$GOPATH directory."
17 -echo "expected within '$GOPATH' but got '$PWD'"
22 +echo "expected within '$GOPATH' but got '$DIR'"
23 exit 1