Version matching needs to be matched in collective development, and version control is a must. This article keeps a record of version control in Go.
Handles Go version manager (hereinafter gvm) https://github.com/moovweb/gvm
There are three main steps to use gvm:
To install gvm, do the following on your terminal
$ bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
$ source /Users/nancy/.gvm/scripts/gvm
Check if the installation is running correctly
$ gvm version
Go Version Manager v1.0.22 installed at hoge
After confirming the installation of gvm, import the version of go handled in development.
gvm install go1.15.6
At this time, the following error may occur.
gvm install go1.15.6
Installing go1.15.6...
* Compiling...
ERROR: Failed to compile. Check the logs at /Users/ko-wa/.gvm/logs/go-go1.15.6-compile.log
ERROR: Failed to use installed version
If you get this error, install the binary as a workaround.
$ gvm install go1.15.6 -B
Installing go1.15.6 from binary source
Reference: https://akataworks.hatenadiary.jp/entry/2016/10/18/201025
Switch the installed version again using the gvm command.
$ gvm use go1.15.6
Now using version go1.15.6
Check the version of go.
$ go version
go version go1.15.6 darwin/amd64
It's okay if it's the default version!
gvm will not be available if you reopen the terminal, so you need to set bash_profile (which runs first when the terminal is opened)
$ cat $HOME/.gvm/scripts/gvm >> ~/.bash_profile
If written, gvm is always available.
Finally, I will write how to change the default if you want to fix the version of Go.
$ gvm use go1.15.6 --default
Now using version go1.15.6
This is how to use Go version control and gvm.