Skip to content

Use go.mod as single source of truth for Go version in CI#2192

Draft
czunker wants to merge 2 commits intomainfrom
czunker/go_mod_version
Draft

Use go.mod as single source of truth for Go version in CI#2192
czunker wants to merge 2 commits intomainfrom
czunker/go_mod_version

Conversation

@czunker
Copy link
Copy Markdown
Contributor

@czunker czunker commented Mar 10, 2026

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.

Copy link
Copy Markdown

@mondoo-code-review mondoo-code-review Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI now reads Go version from go.mod instead of a separate .github/env file, reducing version drift risk.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 10, 2026

Test Results

  1 files  ±0   36 suites  ±0   1m 28s ⏱️ +12s
647 tests ±0  646 ✅ ±0  1 💤 ±0  0 ❌ ±0 
648 runs  ±0  647 ✅ ±0  1 💤 ±0  0 ❌ ±0 

Results for commit 6160dcb. ± Comparison against base commit e5416be.

♻️ This comment has been updated with latest results.

uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version: ">=${{ env.golang-version }}"
go-version-file: go.mod
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@imilchev Please have another look.
I changed how we use the version.

@czunker czunker marked this pull request as draft March 10, 2026 12:08
czunker and others added 2 commits March 12, 2026 08:17
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>
@czunker czunker force-pushed the czunker/go_mod_version branch from 3d99671 to 6160dcb Compare March 12, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants