Written by
Edd Turtle
on gophercoding.com
on
on
(Updated: )
Change Go Version in Mod
Picking up an old Go project, we wanted to update the desired version it should run on (mainly so when we deployed to our live systems it would use this version too). To do this, we updated the version within the go.mod
file - the file which keeps track of both versions and packages used by the project.
We used the command below:
|
|
This then means the go.mod file is updated to look like this:
|
|
Heroku
To further this, if you’re deploying to Heroku, you can add a specific directive to the go.mod to set the Go version.
So it becomes this:
|
|