DEV Community

Pacharapol Withayasakpunt
Pacharapol Withayasakpunt

Posted on

1

go mod, updating to latest versions, and gvm

#go

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 https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
# 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.

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay