-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
build: match Go's GOPATH defaults behaviour #4678
Conversation
if go assumed to be installed, the output of the |
mk/golang.mk
Outdated
@@ -1,6 +1,9 @@ | |||
# golang utilities | |||
GO_MIN_VERSION = 1.9 | |||
|
|||
# match Go's default GOPATH behaviour | |||
GOPATH ?= $(HOME)/go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would replace it with export GOPATH := $(shell $(GOCC) env GOPATH)
I am not 100% sure it works but it should.
bin/check_go_path
Outdated
echo "GOPATH not set, you must have go configured properly to install ipfs" | ||
exit 1 | ||
fi | ||
[ -z "$GOPATH" ] && GOPATH="$HOME/go" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Witch changes to Makefile this should run without changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As aerth pointed out using go env GOPATH
should be best way to go. Can you try it out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commenting to remove my big red cross
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 question
echo "GOPATH not set, you must have go configured properly to install ipfs" | ||
exit 1 | ||
fi | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
mk/golang.mk
Outdated
@@ -1,6 +1,9 @@ | |||
# golang utilities | |||
GO_MIN_VERSION = 1.9 | |||
|
|||
# match Go's default GOPATH behaviour | |||
export GOPATH ?= $(shell $(GOCC) env GOPATH) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait a sec, doesnt this need to go below the definition for GOCC
?
License: MIT Signed-off-by: Lars Gierth <larsg@systemli.org>
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
5ad428f
to
67a6e63
Compare
Fixed |
Thanks for shipping this for me @Kubuxu ❤️ |
This came up while setting up a new system, and trying to do Go things without explicitly setting GOPATH.