GVM(Go Version Manager)是一款用于管理和切换不同Go语言版本的工具
Install #
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
source /root/.gvm/scripts/gvm
check version #
gvm list
Install golang #
#gvm install
gvm install go1.22.2
error: Failed connect to go.googlesource.com:443; Operation now in progress while accessing https://go.googlesource.com/go/info/refs
modify
vim ~/.gvm/scripts/install
reset: GO_SOURCE_URL=https://github.com/golang/go
# gvm install go1.22.4
if erros occured :
cat /root/.gvm/logs/go-go1.22.4-compile.log. check errors
gvm install go1.20
gvm install go1.22.4
gvm use go1.22.4
gvm use go1.22.4 --default
# gvm list
gvm gos (installed)
go1.18.10
go1.20
go1.20.6
=> go1.22.4
system
# go version
go version go1.22.4 linux/amd64