goup
goup is an elegant Go version manager write in rust.
goup is an attempt to fulfill the above features and is heavily inspired by Rustup, golang/dl, goup, goenv, gvm and getgo.
NOTE: Please keep in mind that goup-rs is still under active development and therefore full backward compatibility is not guaranteed before reaching v1.0.0.
Features
- Minimum dependencies, only depend on
git. we may remove this dependency in future. - Multi-platform compatible (Linux, macOS & Windows).
- Install/Remove Go versions with
goup install/remove [TOOLCHAIN]. - Support Installing Go from source with
goup install <nightly|tip|gotip>. - List locally installed versions.
- Switch between multiple installed versions.
- Search available version of Go.
- Manage locally archived files(such as
*.tar.gz,*.tar.gz.sha256). - Upgrade
goupitself. - Friendly prompt.
- Should be pretty fast.
Installation
Cargo
Alternatively, you can also install it using cargo.
cargo install goup-rs
or
cargo install goup-rs --git https://github.com/thinkgos/goup-rs
Manual(for Linux/MacOS)
If you want to install manually, there are the steps:
- Download the latest
goupfrom Release Page - Drop the
goupexecutable to yourPATHand make it executable:mv GOUP_BIN /usr/local/bin/goup && chmod +x /usr/local/bin/goup - Run
goup init, Got shell startup script at$HOME/.goup/env. - Add the Go bin directory to your shell startup script:
echo '. "$HOME/.goup/env"' >> ~/.bashrcorecho '. "$HOME/.goup/env"' >> ~/.zshenv
Manual(for Windows)
MSI-installers
Install the latest version for your system with the MSI-installers from the Release Page section
Binary Compressed
- Download the binary compressed file for Windows version from Release Page, and then unzipping it.
- Move the
goup.exeto$YOUR_PATH. - Add the
$YOUR_PATHto windows environment.
Quick Start
$ goup install
[2024-01-30T00:38:48Z INFO ] Installing go1.21.10 ...
[2024-01-30T00:38:48Z INFO ] Unpacking /home/thinkgo/.goup/go1.21.10/go1.21.10.linux-amd64.tar.gz ...
[2024-01-30T00:38:48Z INFO ] go1.21.10 installed in /home/thinkgo/.goup/go1.21.10
[2024-01-30T00:38:48Z INFO ] Default Go is set to 'go1.21.10'
$ goup list
| VERSION | ACTIVE |
|---------|--------|
| 1.21.10 | * |
$ go env GOROOT
/home/thinkgo/.goup/current
$ go version
go version go1.21.10 linux/amd64
$ GOUP_GO_HOST=https://golang.google.cn goup install 1.21.10
Usage
Lists all available Go versions
goup search [FILTER], [FILTER] can be follow value 'stable', "unstable", 'beta' or any regex string.
List all installed Go version located at $HOME/.goup
| | |
| | |
| | |
| | |
Install specified version of Go
goup install/update [TOOLCHAIN], [TOOLCHAIN] can be follow value 'stable'(default), 'nightly'('tip', 'gotip'), 'unstable', 'beta' or '1.21.4', --dry flag means only install the version, but do not switch.
[TOOLCHAIN] you can use semver syntax to match the version:
- exact:
=1.21.4 - greater:
>1.21.4 - greater equal:
>=1.21.4 - less:
<1.21.4 - less equal:
>=1.21.4 - tilde:
~1.21.4 - caret:
^1.21.4 - wildcard:
1.21.*,1.*.*
Switches to selected Go version
goup use/set [VERSION], switches to selected Go version.
Remove the specified Go version list
goup remove/rm [VERSION]... Remove the specified Go version list. If no version is provided, a prompt will show to select multiple installed Go version
Manage cache archive files
Modify the goup installation
Environment
| | | |
| | | |
| | | |
| | | |
| | | |
Autocompletion
goup completion <SHELL> Generate the autocompletion script for the specified shell. <SHELL> possible values: bash, elvish, fish, powershell, zsh.
More information
goup -h get more information
How it works
goup completion <SHELL>Generate the autocompletion script for the specified shell.goup [help]Print this message or the help of the given subcommand(s).goup install/update [TOOLCHAIN]downloads specified version of Go to$HOME/.goup/go<VERSION|tip>/goand symlinks it to$HOME/.goup/current.goup use/set [VERSION]switches to selected Go version.goup ls/list/showlist all installed Go version located at$HOME/.goup.goup remove/rm [VERSION]...remove the specified Go version list.goup search [FILTER]lists all available Go versions.goup downloads [COMMAND]Manage download archive files.goup self <COMMAND>Modify the goup installation.goup initwrite all necessary environment variables and values to$HOME/.goup/env.goup envShow the specified goup environment variables and values.
How to Debug
Default log level is Info. You can use goup -v <subcommand> or goup -vv <subcommand> to use Debug or Trace level.
FAQ
- Compiling and Installing from source code failure?
The minimum version of Go required depends on the target version of Go, more information see source installation instructions