This pull request cleans up the /usr/local/bin symlinks added by the Go formula.
The current Go formula creates symlinks for everything in /usr/local/Cellar/go/1.2.1/libexec/bin. This directory also includes subdirectories containing cross compiled executables, such as /usr/local/Cellar/go/1.2.1/libexec/bin/windows_386/go.exe. These subdirectories get symlinked into /usr/local/bin:
$ ls -l /usr/local/bin/ | grep go/1.2.1
lrwxr-xr-x 1 ph admin 33 Mar 3 10:21 darwin_386 -> ../Cellar/go/1.2.1/bin/darwin_386
lrwxr-xr-x 1 ph admin 25 Mar 3 10:21 go -> ../Cellar/go/1.2.1/bin/go
lrwxr-xr-x 1 ph admin 28 Mar 3 10:21 gofmt -> ../Cellar/go/1.2.1/bin/gofmt
lrwxr-xr-x 1 ph admin 32 Mar 3 10:21 linux_386 -> ../Cellar/go/1.2.1/bin/linux_386
lrwxr-xr-x 1 ph admin 34 Mar 3 10:21 linux_amd64 -> ../Cellar/go/1.2.1/bin/linux_amd64
lrwxr-xr-x 1 ph admin 32 Mar 3 10:21 linux_arm -> ../Cellar/go/1.2.1/bin/linux_arm
lrwxr-xr-x 1 ph admin 34 Mar 3 10:21 windows_386 -> ../Cellar/go/1.2.1/bin/windows_386
lrwxr-xr-x 1 ph admin 36 Mar 3 10:21 windows_amd64 -> ../Cellar/go/1.2.1/bin/windows_amd64
These symlinks shouldn't be created - they don't point to executable scripts and they're not well named. This pull request fixes that behavior so that only go and gofmt are symlinked:
$ ls -l /usr/local/bin | grep go/1.2.1
lrwxr-xr-x 1 ph admin 25 Mar 3 11:07 go -> ../Cellar/go/1.2.1/bin/go
lrwxr-xr-x 1 ph admin 28 Mar 3 11:07 gofmt -> ../Cellar/go/1.2.1/bin/gofmt
Go: Don't put cross-compile artifacts in bin
Presumably go still finds these files when needed while cross-compiling?
A good question. I think these files are just a side effect of building the entire source tree with different settings. They're literally executables for a different platform as far as I can tell aren't actually used when cross-compiling. Even if they were, internally I'm also fairly sure that Go uses it's GOROOT setting (/usr/local/Cellar/go/1.2.1/libexec) and doesn't rely on $PATH.
But there were lots of assertions in the last paragraph so, just to be safe, I did a test recompile, which works:
$ GOOS=linux GOARCH=amd64 go build hello.go
$ file ./hello
./hello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped
I also cross-compiled a more complicated internal project and successfully ran that on a linux server. I can't paste the output there for obvious reasons, but it worked.
go: update 1.2.1 bottle.
Signed-off-by: Mike McQuaid <firstname.lastname@example.org>