Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/go: no easy way to install multiple binaries to desired location when cross-compiling #13063
It's quite common to want to install a bunch of commands in
Something like this can work, but feels clumsy:
Perhaps if GOPATH has more than one element, binaries should
would do the trick, installing to $destdir/bin/$GOOS_$GOARCH
changed the title from
no easy way to install multiple binaries to desired location when cross-compiling
cmd/go: no easy way to install multiple binaries to desired location when cross-compiling
Oct 27, 2015
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.
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