Golang version manager. Shell script to manage multiple active golang versions.
Install using Fisher(or other plugin manager):
fisher install tenfyzhong/gg
Use homebrew to install
brew tap tenfyzhong/tap
brew install gg
- download
functions/gg.fishto~/.config/fish/functions - download
completionsto~/.config/fish/completions
- download
ggto a directory in your$PATH, such as/usr/local/bin - download
gg-completions.bashto a directory and source it in your.bashrc
- download
ggto a directory in your$PATH, such as/usr/local/bin - download
_ggto a directory in youfpath
gg is a Golang version manager. It can download a special version of golang, and switch to it.
gg wraps golang.org/dl, make it easy to download and install golang version.
If you install a special version manually, you should install follow this steps:
go install golang.org/dl/go1.18@latest, install a go to$GOPATH/bingo1.18 download, download the archived go to~/sdk/
After you install the special version golang, you can use such as: go1.18 <subcommand>
for example: go1.18 build or go1.18 install
In other ways, you can set the GOROOT environment variable to specify the path of golang version.
For bash shell:
export GOROOT=$HOME/sdk/go1.18
export PATH=$GOROOT/bin:$PATHFor fish shell:
set -gx GOROOT $HOME/sdk/go1.18
fish_add_path $GOROOT/binUsing gg, you can run gg use 1.18 to get the command above to run.
If you use direnv, you can set the bash environment to .envrc file, it will automatically use the special version when you cd to the directory.
With gg, you can run this command to set the environment automatic:
gg use -b 1.18 >> .envrc; direnv allowCommand gg has 5 subcommands which help you to download or use a special version of golang:
| command | options | description |
|---|---|---|
gg ls |
list local version | |
gg ls-remote |
list remote version | |
gg install |
version... | install specified version |
gg remove |
version... | remove specified version |
gg use |
version | remove specified version |
Command ggenv combine gg use and direnv allow, make it use gg and direnv easily