Use go.mod as single source of truth for Go version in CI#2192
Use go.mod as single source of truth for Go version in CI#2192
Conversation
| uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0 | ||
| with: | ||
| go-version: ">=${{ env.golang-version }}" | ||
| go-version-file: go.mod |
There was a problem hiding this comment.
i think this will not do what we want it to do. go.mod is specifying the minimum go version required to build our binary. However, that doesn't mean we cannot use a newer version to build it.
If we pair these 2 it means we always need to update the go.mod version to latest possible Go complier, to use the latest compiler improvements in the toolchain. When we have 2 separate number, we can still make sure the server builds with older versions but use newer Go versions just for building in CI
There was a problem hiding this comment.
I don't understand this part:
When we have 2 separate number, we can still make sure the server builds with older versions ...
What do we need the old versions for?
When we want the latest patch version, we could use: https://github.com/actions/setup-go/blob/main/docs/advanced-usage.md#check-latest-version
There was a problem hiding this comment.
we are importing this in other projects as well. Forcing the latest go version in the go.mod would mean anywhere where we import cnspec we will need to be updating the go version in the go.mod. As we have seen in the past that may not always be possible if other packages don't build with latest golang version
There was a problem hiding this comment.
@imilchev Please have another look.
I changed how we use the version.
Read Go version from go.mod via go-version-file instead of .github/env, and bump Go from 1.25.1 to 1.25.8. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This ensures CI always uses the latest patch release matching the go.mod version, picking up security fixes without manual bumps. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3d99671 to
6160dcb
Compare
Read Go version from go.mod via go-version-file instead of .github/env, and bump Go from 1.25.1 to 1.25.8.