goenv icon indicating copy to clipboard operation
goenv copied to clipboard

Go Version Manager (same as rbenv, pyenv, tfenv and tgenv)

Release Version Build CI CodeQL Go Report Card License Releases

goenv (Golang Version Manager)

goenv is a command-line tool to manage multiple versions of Golang on your system.

Installation

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

Usage

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

List all remote versions 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
...

Install a specific version of GOLANG

$ 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.

Use a specific version of GOLANG

$ goenv --use 1.20.6
Using Go version 1.20.6.
Please make sure to execute: source ~/.bashrc

List all installed GOLANG versions

$ goenv --list
Installed Golang versions:
* 1.20.6  (Currently active GOLANG version)
  1.20.5
  1.20.4

Supported Shell

  • Bash
  • Zsh

Support

Feel free to create an Issue/Pull Request if you find any bug with goenv