Update globally installed go binaries.
The missing go command similar to npm -g update or
cargo install-update.
- Requirements
- Installation
- Usage
- Upgrading
go-global-update - Troubleshooting
- How it works
- Alternative tools
- Contributing
- Go 1.16 or higher
go install github.com/Gelio/go-global-update@latestRunning
go-global-updatewill print information about currently installed global binaries and attempt to upgrade those that have newer versions.
You can also do a dry run without update the binaries:
go-global-update --dry-runor update just a handful of binaries:
go-global-update gofumptFor more information, see
go-global-update --helpgo-global-update will take care of updating itself when it updates other
binaries.
Do you have problems updating some binaries using go-global-update? Take a
look at TROUBLESHOOTING.md for more information.
go-global-update consists of the following steps:
-
Determine binaries to inspect.
Either use the list of provided arguments or all executables installed in your
go env GOBIN(or$(go env GOPATH)/bin). -
Inspect where each executable came from (by running
go version -m [executable name]and checking thepath), -
Check the latest version for each binary using
go list -m -f "{{.Version}}" [path] -
If the binary has a newer version, run
go install [package path]@latestto update it.
go-global-update is not the only tool trying to solve the problem of updating
globally-installed go binaries. The alternatives are:
-
Advantages:
- includes desktop notifications
- has a subcommand to remove a binary
- has a way to export/import a list of binaries
Disadvantages:
- does not offer troubleshooting information when an upgrade fails
- does not report error logs from failed updates
- updates binaries installed from source (potentially overwrites locally-made changes)
-
Disadvantages:
-
seems not to detect globally-installed binaries using go modules
$ binstale binstale (no source package found) go-global-update stale: github.com/Gelio/go-global-update (stale dependency: github.com/Gelio/go-global-update/internal/colors) gofumpt (no source package found) gotop (no source package found) misspell (no source package found) shfmt
-
Contributions are welcome! See CONTRIBUTING.md for more information.
