Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix check_go_path when it has spaces in it #5261

Merged
merged 5 commits into from
Jul 23, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions bin/check_go_path
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
#!/bin/sh

PWD=$1
set -e

if [ -z "$PWD" ]; then
echo "must pass in your current working directory"
exit 1
fi
PKG="$1"

while [ ${#} -gt 1 ]; do
if [ "$PWD" = "$2" ]; then
exit 0
fi
shift
done
DIR="$(pwd -P)"
GOPATH="$(go env GOPATH)"

while read -d ':' 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:"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI is unhappy about this, probably want to switch to #!/usr/bin/env bash


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
2 changes: 1 addition & 1 deletion mk/golang.mk
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ check_go_version:
DEPS_GO += check_go_version

check_go_path:
bin/check_go_path $(realpath $(shell pwd)) $(realpath $(addsuffix /src/github.com/ipfs/go-ipfs,$(subst $(PATH_SEP),$(space),$(GOPATH))))
GOPATH="$(GOPATH)" bin/check_go_path github.com/ipfs/go-ipfs
.PHONY: check_go_path
DEPS_GO += check_go_path

Expand Down