Skip to content

jaronnie/gvm

Repository files navigation

gvm

GitHub release Build Status Build Status Go Report Card codecov

golang version manage

quick start

docker run -it jaronnie/gvm:latest bash
# docker run -it jaronnie/gvm:latest-arm64 bash
gvm install go1.20
gvm activate go1.20

download gvm

download by source

go install github.com/jaronnie/gvm@latest

download from releases

download

curl -L -o gvm.tar.gz https://github.com/jaronnie/gvm/releases/download/v1.6.0/gvm_1.6.0_Linux_x86_64.tar.gz

gvm init

gvm init
# gvm init <shellType>

gvm complete

zsh:
# echo "autoload -U compinit; compinit" >> ~/.zshrc
gvm completion zsh > "${fpath[1]}/_gvm"

linux bash:
gvm completion bash > /etc/bash_completion.d/gvm

gvm install

# will install go 1.18
gvm install go1.18

# will install go 1.18.5 version
gvm install go1.18.5

# install offline, default package file path is ~/gvm
gvm install go1.18.5 --offline

# install offline, package file path is .
gvm install go1.18.5 --offline -p .

gvm list

# list local go
gvm list

# list remote go
gvm list --remote

# list remote go with limit number
gvm list --remote -n 100

# list all
gvm list --remote --all

gvm activate

# will activate go 1.18 environment
gvm activate go1.18

gvm uninstall

gvm uninstall go1.18.5

QA

download go package error

gvm config --registry https://mirrors.aliyun.com/golang

bash completion error: bash: _get_comp_words_by_ref: command not found

# centos
yum -y install bash-completion

gvm init: Error: can not get shell type

# gvm init <shellType>
gvm init bash

bash: permission denied: /etc/bash_completion.d/gvm

gvm completion bash | sudo tee /etc/bash_completion.d/gvm > /dev/null

todo

  • support windows