DEV Community


go mod, updating to latest versions, and gvm

patarapolw profile image Pacharapol Withayasakpunt ・1 min read

So, I installed Golang using apt (inside WSL Ubuntu Linux); created a project outside GOROOT with go mod init, then want to update to the latest Go version (1.15.5).

The easiest way to do this (as far as I have experimented), is using gvm. (Similarly, Python => pyenv; Node.js => nvm; Ruby => rbenv; Java => SDKman.)

zsh < <(curl -s -S -L
# or bash < <(...)
Enter fullscreen mode Exit fullscreen mode

Then, edit the ./go.mod

go 1.15.5
Enter fullscreen mode Exit fullscreen mode

I think, knowing this is important, when you are using go mod, because go version will then be fixed inside go.mod.

Actually, VSCode itself can also choose go version, but much less flexible.


Editor guide