goenv is a command-line tool to manage multiple versions of Golang on your system.
Releases: https://github.com/ankitcharolia/goenv/releases
LINUX
wget -O - https://github.com/ankitcharolia/goenv/releases/latest/download/goenv-linux-amd64.tar.gz | tar -xz -C ~/.go
export PATH=$HOME/.go:$PATH >> ~/.bashrc
source ~/.bashrc
MAC
wget -O - https://github.com/ankitcharolia/goenv/releases/latest/download/goenv-darwin-amd64.tar.gz | tar -xz -C ~/.go
export PATH=$HOME/.go:$PATH >> ~/.zshrc
source ~/.zshrc
goenv provides several commands to manage Golang versions on your system.
$ goenv --help
Usage: goenv [flags] [<options>]
Flags:
--help goenv help command
--install Install a specific version of GOLANG
--list List all installed GOLANG versions
--list-remote List all remote versions of GOLANG
--uninstall Uninstall a specific version of GOLANG
--use Use a specific version of GOLANG
$ goenv --list-remote
1.21rc3
1.21rc2
1.20.6
1.20.5
1.20.4
1.20.3
1.20.2
1.20.1
...
$ goenv --install 1.20.6
Installing Go version 1.20.6...
https://dl.google.com/go/go1.20.6.linux-amd64.tar.gz
95.57 MiB / 95.57 MiB [-----------------------------------------------------------------------------------------------] 100.00% 13.92 MiB p/s 7.1s
Go version 1.20.6 is installed at $HOME_DIRECTORY/.go/1.20.6.
$ goenv --use 1.20.6
Using Go version 1.20.6.
Please make sure to execute: source ~/.bashrc
$ goenv --list
Installed Golang versions:
* 1.20.6 (Currently active GOLANG version)
1.20.5
1.20.4
- Bash
- Zsh
Feel free to create an Issue/Pull Request if you find any bug with goenv