Skip to content

build: match Go's GOPATH defaults behaviour #4678

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

Merged
merged 3 commits into from
Mar 25, 2018
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 1 addition & 6 deletions bin/check_go_path
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ if [ -z "$PWD" ]; then
exit 1
fi

if [ -z "$GOPATH" ]; then
echo "GOPATH not set, you must have go configured properly to install ipfs"
exit 1
fi

Copy link
Member

Choose a reason for hiding this comment

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

I'd still keep this check (assuming it didn't break, which it shouldn't) so if something goes wrong it's caught.

Copy link
Member

Choose a reason for hiding this comment

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

I disagree, we are already passing GOPATHs as arguments to this function (as $2, $3 and so on). So this check is IMO not needed.

Copy link
Author

Choose a reason for hiding this comment

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

GOPATH doesn't have to be set anymore. I'm actually not sure why the export in golang.mk doesn't carry over.

Copy link
Member

Choose a reason for hiding this comment

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

It does, I just wanted to make this script be runnable semi stand alone.

while [ ${#} -gt 1 ]; do
if [ "$PWD" = "$2" ]; then
exit 0
Expand All @@ -20,5 +15,5 @@ while [ ${#} -gt 1 ]; do
done

echo "go-ipfs must be built from within your \$GOPATH directory."
echo "expected within '$GOPATH' but got '$PWD'"
echo "expected within '$(go env GOPATH)' but got '$PWD'"
exit 1
4 changes: 4 additions & 0 deletions mk/golang.mk
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# golang utilities
GO_MIN_VERSION = 1.9


# pre-definitions
GOCC ?= go
GOTAGS ?=
GOFLAGS ?=
GOTFLAGS ?=

# match Go's default GOPATH behaviour
export GOPATH ?= $(shell $(GOCC) env GOPATH)

DEPS_GO :=
TEST_GO :=
TEST_GO_BUILD :=
Expand Down