Skip to content

build: add version check for go mod #7229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

flc1125
Copy link
Member

@flc1125 flc1125 commented Apr 15, 2025

This seems to be skippable CHANGELOG.

Usage:

MINIMUM_GO_VERSION="go 1.23.0" make verify-goversion

@flc1125 flc1125 requested review from dmathieu and a team as code owners April 15, 2025 15:40
Copy link

codecov bot commented Apr 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.0%. Comparing base (2adc680) to head (f4644ce).

Additional details and impacted files

Impacted file tree graph

@@          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     

see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dmathieu
Copy link
Member

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.

@flc1125
Copy link
Member Author

flc1125 commented Apr 16, 2025

I will study how the internal/tools directory operates. I'll first set this PR to draft mode.

@flc1125 flc1125 marked this pull request as draft April 16, 2025 10:34
@flc1125
Copy link
Member Author

flc1125 commented Apr 23, 2025

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_VERSION for now.

@flc1125 flc1125 changed the title test: add go.mod version consistency test build: add version check for go mod Apr 23, 2025
@flc1125 flc1125 marked this pull request as ready for review April 23, 2025 16:46
@dmathieu
Copy link
Member

EXPECTED_GO_VERSION seems like a good idea.
Could you add tests to the Go file as well?

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.

2 participants