build: add version check for go mod
This seems to be skippable CHANGELOG.
Usage:
MINIMUM_GO_VERSION="go 1.23.0" make verify-goversion
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 81.0%. Comparing base (
2adc680) to head (f4644ce).
Additional details and impacted files
@@ Coverage Diff @@
## main #7229 +/- ##
=====================================
Coverage 81.0% 81.0%
=====================================
Files 204 204
Lines 18080 18080
=====================================
+ Hits 14651 14654 +3
+ Misses 3003 3001 -2
+ Partials 426 425 -1
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
This is a nice idea. I would take a different approach though. In here, the go version is a constant within the test, which means an additional thing to change when we upgrade the Go version.
How about a new tool in internal/tools that does the same thing, with the expected Go version taken from an environment variable (or a CLI flag).
Kind of like what we do here: https://github.com/open-telemetry/opentelemetry-go/tree/main/internal/tools/verifyreadmes
Then, we can have a new CI task that uses the proper Go version.
We can add a MINIMUM_GO_VERSION in ci.yml. We'll have to update it on upgrades, but it's all in the same file.
I will study how the internal/tools directory operates. I'll first set this PR to draft mode.
MINIMUM_GO_VERSION
@dmathieu I'm wondering if it's appropriate for us to use MINIMUM_GO_VERSION as the naming convention.
According to most people's understanding, MINIMUM_GO_VERSION should represent the minimum version we support. This means when we set it to v1.23.0, it actually allows versions like v1.23.1/v1.24.0 and so on.
However, the effect we actually want is for all Go Mods to be uniform.
For this reason, would EXPECTED_GO_VERSION be a more suitable choice?
If you have a better name, you can also let me know.
PS: Before finalizing this, I will tentatively submit it as
MINIMUM_GO_VERSIONfor now.
EXPECTED_GO_VERSION seems like a good idea. Could you add tests to the Go file as well?