Skip to content

Commit

Permalink
fix check_go_path when it has spaces in it
Browse files Browse the repository at this point in the history
fixes #5260
  • Loading branch information
Stebalien committed Jul 19, 2018
1 parent 6f140d2 commit 6a7f724
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
21 changes: 10 additions & 11 deletions bin/check_go_path
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
#!/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
PWD="$(realpath "$(pwd)")"
GOPATH="$(go env GOPATH)"

for p in IFS=: "${GOPATH}"; do
if [ "$PWD" = "$(realpath "$p")/src/$PKG" ]; then
exit 0
fi
done

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 '$PWD'"
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

1 comment on commit 6a7f724

@GitCop
Copy link

@GitCop GitCop commented on 6a7f724 Jul 19, 2018

Choose a reason for hiding this comment

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

There were the following issues with your Pull Request

We ask for a few features in the commit message for Open Source licensing hygiene and commit message clarity.
git commit --amend can often help you quickly improve the commit message.
Guidelines and a script are available to help in the long run.
Your feedback on GitCop is welcome on this issue.


This message was auto-generated by https://gitcop.com

Please sign in to comment.