-
Notifications
You must be signed in to change notification settings - Fork 18k
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
cmd/go: no easy way to install multiple binaries to desired location when cross-compiling #13063
Comments
Not sure I agree that there isn't a straight forward alternative. The problem is its inconsistent. consistency is why I suggested just using a flag to force the directory mode. #11001. That approach was to keep current behaviour, but if we don't care about maintaining that then lets just drop the creation of additional directories and emit warnings (or refuse to compile) when GOBIN isn't set and you are compiling to a non-native binary. I don't see requiring GOBIN to be set when cross compiling would be a huge issue, we specify the majority GOBIN=$PWD/darwin-amd64 GOOS=darwin GOARCH=amd64 go install ./...
GOBIN=$PWD/linux-amd64 GOOS=linux GOARCH=amd64 go install ./... would write to different directories and be safe where as: GOOS=darwin GOARCH=amd64 go install ./...
GOOS=linux GOARCH=amd64 go install ./... would overwrite each other and emit a warning (or error) for one of the attempts depending if you where on mac or linux. |
+1 I'll explain my use case: I run Before the changes as discussed in #9769 it worked nicely for all go commands including |
The problem still exists in 1.8.x. the automagic |
This comment has been minimized.
This comment has been minimized.
That's #14295. |
Anyone have a use-case that would not be handled by #14295? |
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
It's quite common to want to install a bunch of commands in
a single repository with "go install ./...". When packaging things
and not cross-compiling, we can use GOBIN to cause the binaries
to be written to a given directory. This doesn't work when cross-compiling
(see issue #9769), but there's no straightforward alternative.
Something like this can work, but feels clumsy:
Perhaps if GOPATH has more than one element, binaries should
be installed to the first element of GOPATH, similarly to packages.
Then:
would do the trick, installing to $destdir/bin/$GOOS_$GOARCH
The text was updated successfully, but these errors were encountered: