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.fish
to~/.config/fish/functions
- download
completions
to~/.config/fish/completions
- download
gg
to a directory in your$PATH
, such as/usr/local/bin
- download
gg-completions.bash
to a directory and source it in your.bashrc
- download
gg
to a directory in your$PATH
, such as/usr/local/bin
- download
_gg
to 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/bin
go1.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:$PATH
For fish shell:
set -gx GOROOT $HOME/sdk/go1.18
fish_add_path $GOROOT/bin
Using 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 allow
Command 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