Skip to content

Commit ed82e4e

Browse files
Merge pull request #4678 from ipfs/fix/gopath-default
build: match Go's GOPATH defaults behaviour
2 parents 7d84246 + 67a6e63 commit ed82e4e

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

bin/check_go_path

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ if [ -z "$PWD" ]; then
77
exit 1
88
fi
99

10-
if [ -z "$GOPATH" ]; then
11-
echo "GOPATH not set, you must have go configured properly to install ipfs"
12-
exit 1
13-
fi
14-
1510
while [ ${#} -gt 1 ]; do
1611
if [ "$PWD" = "$2" ]; then
1712
exit 0
@@ -20,5 +15,5 @@ while [ ${#} -gt 1 ]; do
2015
done
2116

2217
echo "go-ipfs must be built from within your \$GOPATH directory."
23-
echo "expected within '$GOPATH' but got '$PWD'"
18+
echo "expected within '$(go env GOPATH)' but got '$PWD'"
2419
exit 1

mk/golang.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# golang utilities
22
GO_MIN_VERSION = 1.9
33

4+
45
# pre-definitions
56
GOCC ?= go
67
GOTAGS ?=
78
GOFLAGS ?=
89
GOTFLAGS ?=
910

11+
# match Go's default GOPATH behaviour
12+
export GOPATH ?= $(shell $(GOCC) env GOPATH)
13+
1014
DEPS_GO :=
1115
TEST_GO :=
1216
TEST_GO_BUILD :=

0 commit comments

Comments
 (0)