How to Correctly Update Your Golang Project Version
Before upgrading Go to specific version, you need to upgrade the environment. Next refer to the following sections to upgrade Go version:
Upgrade the Go version in go.mod
The go.mod file specifices the Go version used in project.
Find the current Go version on the file line of go.mod file. For example, if the version is 1.19
, change to 1.22
(or whatever version you want to upgrade to). This step is curcial as it tells Go to compile your project with the specified version.
go 1.22
Continue Reading