We try to use the latest-greatest Go version in our projects, but in order to provide reproducible builds, Go version is pinned and changing it is always a manual process.
As a thumb rule, patch versions can be used as soon as they are released, minor versions should be thoroughly tested before reaching production systems.
General steps to change Go version:
- Edit
Makefile
(if there is one in the project) and changeGO_VERSION
to the desired version. (make build
verifies that Go is at least at that version or higher) - Edit
.circleci/config.yaml
(if there is one in the project) and change the following to the desired version:GO_VERSION
environment variablebanzaicloud/golang:<version>
build imagecircleci/golang:<version>
build image
- Edit
.github/workflows/*.yml
workflow files (if there is any in the project) and changego-version
to the desired version. (In case of libraries this could be a list of versions: add the version to the list, check if removing old versions is necessary.) - Edit
Dockerfile
(and every otherDockerfile.*
files) and changeFROM golang:<version>
to the desired version. - Edit
go.mod
and change thego
directive to the desired version (Only in case of applications!)