CLI to manage Go binaries
gobin is a CLI tool that leverages the Go toolchain to list, inspect, upgrade, uninstall and diagnose Go binaries installed in the system.
- Inspect binary information
- List and show outdated binaries
- Upgrade individual or all outdated binaries
- Install, uninstall and pin binaries
- Diagnose and troubleshoot issues with installed binaries
- Migrate binaries to be managed internally
go install github.com/brunoribeiro127/gobin/cmd/gobin@latestLinux/MacOS:
curl -L -o gobin_<version>_<os>_<arch>.tar.gz https://github.com/brunoribeiro127/gobin/releases/download/v<version>/gobin_<version>_<os>_<arch>.tar.gz
tar -xzf gobin_<version>_<os>_<arch>.tar.gz
mv gobin $HOME/go/bin # adjust to your Go binaries pathWindows (PowerShell):
Invoke-WebRequest https://github.com/brunoribeiro127/gobin/releases/download/v<version>/gobin_<version>_windows_<arch>.tar.gz -OutFile gobin.tar.gz
tar -xzf gobin.tar.gz
Move-Item .\gobin.exe "$env:USERPROFILE\go\bin" # adjust to your Go binaries pathNote: All releases include checksums and cryptographic signatures for verification. Use cosign to verify signatures if desired.
Requirements:
- Go >= v1.24
- Taskfile >= v3
git clone https://github.com/brunoribeiro127/gobin.git
cd gobin
task install| Command | Description | Flags |
|---|---|---|
completion [shell] |
Generate shell completion scripts | |
doctor |
Diagnose issues for binaries | |
info [binary] |
Show info about a binary | |
install [packages] |
Install and pin packages | -k, --kind – pin kind: [latest (default), major, minor]-r, --rebuild – force package rebuild |
list |
List installed binaries | -m, --managed – list all managed binaries |
migrate [binaries] |
Migrate binaries to be managed internally | -a, --all – migrate all binaries in the Go binary path |
outdated |
List outdated binaries | -m, --major – include major version updates |
pin [binaries] |
Pin binaries to the Go binary path | -k, --kind – pin kind: [latest (default), major, minor] |
prune [binaries] |
Prune binaries from the internal binary directory | -a, --all – prune all binaries |
repo [binary] |
Show binary repository | -o, --open – open repository URL in the default browser |
uninstall [binaries] |
Uninstall binaries | |
upgrade [binaries] |
Upgrade specific binaries or all with --all | -a, --all – upgrade all binaries-m, --major – allow major version upgrade-r, --rebuild – force binary rebuild |
version |
Show version info | -s, --short – print short version |
For more information for each command, run gobin help <command>.
These flags can be used with any command:
| Flag | Description |
|---|---|
-v, --verbose |
Enable verbose output (debug logging) |
-p, --parallelism |
Number of concurrent operations (default: number of CPU cores) |
Installation of multiple versions of the same binary is supported. The GOBIN environment variable is used to redirect the binary installation to an internal temporary directory. Then, the binary is moved to the internal binary path with the format <binary>@<version>. Finally, a symbolic link is created to the Go binary path to ensure the binary is available in the system path.
Binaries are installed internally in the following paths:
- Linux/MacOS:
$HOME/.gobin/bin - Windows:
%USERPROFILE%\AppData\Local\gobin\bin
The Go binary installation path is determined by the following:
- checks if the
GOBINenvironment variable is set - if not, checks if the
GOPATHenvironment variable is set - if not, use the default path
$HOME/go/bin
Although not recommended, it is possible to manage multiple binary paths by passing the GOBIN or GOPATH environment variables to the command. The tool leverages the Go toolchain and injects all Go environment variables to the commands used to manage binaries. The support for private modules is guaranteed by setting the GOPRIVATE environment variable.
This project is dual-licensed under MIT or Apache 2.0.
