Home > Mobile >  Is there any way to switch go version handily in macOS?
Is there any way to switch go version handily in macOS?

Time:10-07

Is there any good way to switch go version in macos?

if using python, we can define python2, python2.7, python3, python3.5 to use different version. but what about go?

we know the go install directory is GOROOT:

$ go env GOROOT
/usr/local/go

in macOS there usually only one installed. is it possible to install multi go in macOS and switch easily?

CodePudding user response:

One easy way to do this is with the version manager gvm.

After installation (depending on your system), you can select your Go version (e.g., Go 1.16) with:

gvm install go1.16
gvm use go1.16 [--default]

CodePudding user response:

If Go is not the only language in your toolset, you can also take a look at asdf and its Golang plugin. I personally like that it allows managing versions of different tools instead of installing a separate version manager for each language/tool.

  •  Tags:  
  • go
  • Related