Command gobin Go commands by reading their import paths, go-getting their repositories and building new executables.
Command gobin can search for and list Go executables, create a $GOPATH workspace out of a binary. It can also update an executable which does not have its sources fetched in current $GOPATH.
Command gobin can guess an origin of the sources used to build Go executables it finds on a system. It can be used to create precise mirror of the sources for system Go executables, without any unneeded packages.
~ $ gobin -s /tmp/gopath godoc golint goimports gotree gowhich code.google.com/p/go.tools (download) github.com/rjeczalik/tools (download) github.com/rjeczalik/which (download) (...) github.com/rjeczalik/which/cmd/gowhich code.google.com/p/go.tools/cmd/godoc ~ $ tree -L 3 /tmp/gopath/src/ /tmp/gopath/src/ ├── code.google.com │ └── p │ └── go.tools └── github.com └── rjeczalik ├── tools └── which 7 directories, 0 files
Command gobin can update single executable or automagically discover all of them in directories specified in $GOPATH, $GOBIN and $GOPATH environment variables.
Executing gobin without any arguments makes it list all Go executables found in $GOPATH, $GOBIN and $GOPATH.
Updating multiple executables is performed on multiple goroutines, bumping up $GOMAXPROCS environment variable may speed up the overall run-time significantly.
~ $ GOMAXPROCS=2 gobin -u ok /home/rjeczalik/bin/goimports (code.google.com/p/go.tools/cmd/goimports) 13.966s ok /home/rjeczalik/bin/godoc (code.google.com/p/go.tools/cmd/godoc) 17.960s ok /home/rjeczalik/bin/pulsecli (github.com/x-formation/pulsekit/cmd/pulsecli) 13.052s ok /home/rjeczalik/workspace/bin/pulsecli (github.com/x-formation/pulsekit/cmd/pulsecli) 13.052s
NAME: gobin - looks for Go executables system-wide ($PATH/$GOBIN/$GOPATH), lists them, fetches their sources and updates them USAGE: gobin [-u] [-s=.|gopath] [path|package...] FLAGS: -u Updates Go binaries -s <dir> Go-gets sources for Go specified binaries into <dir> $GOPATH (use '.' for current $GOPATH) -ldflags=<flags> passes "-ldflags=flags" to "go install" EXAMPLES: gobin Lists all Go binaries (looks up $PATH/$GOBIN/$GOPATH) gobin -s=. ~/bin Go-gets sources used to build all Go binaries in ~/bin into current $GOPATH gobin -s=/var/mirror Go-gets all sources used to build all Go binaries found on system into new /var/mirror $GOPATH gobin -u Updates all Go binaries gobin -u github.com Updates all Go binaries installed from github.com gobin ~/bin Lists all Go binaries from the ~/bin directory