Skip to content

Commit

Permalink
avoid realpath in check_go_path
Browse files Browse the repository at this point in the history
It doesn't exist on all operating systems.

License: MIT
Signed-off-by: Steven Allen <[email protected]>
  • Loading branch information
Stebalien committed Jul 19, 2018
1 parent 439b0e3 commit 5ac752f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions bin/check_go_path
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@ set -e

PKG="$1"

PWD="$(realpath "$(pwd)")"
DIR="$(pwd -P)"
GOPATH="$(go env GOPATH)"

for p in IFS=: "${GOPATH}"; do
if [ "$PWD" = "$(realpath "$p")/src/$PKG" ]; then
while read -d ':' p; do
if ! cd "$p/src/$PKG" 2>/dev/null; then
continue
fi

if [ "$DIR" = "$(pwd -P)" ]; then
exit 0
fi
done
cd "$DIR"
done <<< "$GOPATH:"

echo "go-ipfs must be built from within your \$GOPATH directory."
echo "expected within '$GOPATH' but got '$PWD'"
echo "expected within '$GOPATH' but got '$DIR'"
exit 1

0 comments on commit 5ac752f

Please sign in to comment.