Unverified Commit 8ae51191 authored by Whyrusleeping's avatar Whyrusleeping Committed by GitHub

Merge pull request #5261 from ipfs/fix/5260

fix check_go_path when it has spaces in it
parents 8a299852 7a3566b0
#!/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
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment