-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5261 from ipfs/fix/5260
fix check_go_path when it has spaces in it
- Loading branch information
Showing
2 changed files
with
24 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,30 @@ | ||
#!/bin/sh | ||
#!/usr/bin/env bash | ||
|
||
PWD=$1 | ||
set -e | ||
|
||
if [ -z "$PWD" ]; then | ||
echo "must pass in your current working directory" | ||
exit 1 | ||
PKG="$1" | ||
|
||
DIR="$(pwd -P)" | ||
GOPATH="$(go env GOPATH)" | ||
|
||
# The path separator is ; on windows. | ||
if [ "$(go env GOOS)" = "windows" ]; then | ||
PATHSEP=';' | ||
else | ||
PATHSEP=':' | ||
fi | ||
|
||
while [ ${#} -gt 1 ]; do | ||
if [ "$PWD" = "$2" ]; then | ||
exit 0 | ||
fi | ||
shift | ||
done | ||
while read -r -d "$PATHSEP" p; do | ||
if ! cd "$p/src/$PKG" 2>/dev/null; then | ||
continue | ||
fi | ||
|
||
if [ "$DIR" = "$(pwd -P)" ]; then | ||
exit 0 | ||
fi | ||
cd "$DIR" | ||
done <<< "$GOPATH$PATHSEP" | ||
|
||
echo "go-ipfs must be built from within your \$GOPATH directory." | ||
echo "expected within '$(go env GOPATH)' but got '$PWD'" | ||
echo "expected within '$GOPATH' but got '$DIR'" | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters