-
Notifications
You must be signed in to change notification settings - Fork 5k
Prevent Unnecessary Version Bumps in go.mod
During Go Version Updates
#20781
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
Conversation
This PR addresses issue kubernetes#20770, where the minikube automation (triggered by make `update-golang-version`) unnecessarily bumped minor or patch versions in `go.mod` when updating the Go version. Following Kubernetes' practice, which avoids such bumps in `go.mod`, this change ensures only the go directive is updated to the stable Go version. **Changes:** - Added `go.mod` to the schema map in `hack/update/golang_version/update_golang_version.go` with a regex (go 1\.\d+\.\d+) to update the go directive to {{.StableVersion}} (e.g., go 1.24.2). - This ensures the automation updates only the go directive without modifying module dependencies, aligning with Kubernetes' `go.mod` behavior. **Impact:** - Running make `update-golang-version` now updates the go directive (e.g., from go 1.22.3 to go 1.24.2) without unintended dependency version bumps. - Tested by setting go 1.22.3 in go.mod, running go mod tidy and make update-golang-version, and verifying only the go directive and toolchain changed. fixes: kubernetes#20773
Hi @Victorthedev. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Can one of the admins verify this patch? |
**Description**: Fixes kubernetes#20773 by updating the automation to pin the `go` directive in `go.mod` to the major.minor Go version (e.g., `1.24.0`) instead of the full version (e.g., `1.24.2`), aligning with Kubernetes’ `go.mod`. This prevents breaking users relying on minikube packages. **Changes**: - Modified `hack/update/golang_version/update_golang_version.go` to compute `MajorMinor` version (e.g., `1.24.0`) from `StableVersion`. - Updated `schema` to set `go.mod`’s `go` directive to `{{.MajorMinor}}`. - Tested by setting `go 1.23.4`, running `make update-golang-version`, and verifying `go 1.24.0` with no dependency bumps. **Closes**: kubernetes#20773
@medyagh @ComradeProgrammer The second commit fixes issue as it ignore patch version updates in go.mod for go. In the first commit, safe to say i misunderstood the issue at first. Run make update-golang-version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you very much @Victorthedev do you mind only pushing the change that affect the automation and let the automation to do the change?
Keywords which can automatically close issues and at(@) or hashtag(#) mentions are not allowed in commit messages. The list of commits with invalid commit messages:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
@medyagh I have reverted all files to upstream master except update_golang_version.go, now running make update-golang-version would do the changes |
@medyagh one required check is pending for the PR to be merged |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: medyagh, Victorthedev The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This PR addresses issue #20770, where the minikube automation (triggered by make
update-golang-version
) unnecessarily bumped minor or patch versions ingo.mod
when updating the Go version. Following Kubernetes' practice, which avoids such bumps ingo.mod
, this change ensures only the go directive is updated to the stable Go version.Changes:
go.mod
to the schema map inhack/update/golang_version/update_golang_version.go
with a regex (go 1.\d+.\d+) to update the go directive to {{.StableVersion}} (e.g., go 1.24.2).go.mod
behavior.Impact:
update-golang-version
now updates the go directive (e.g., from go 1.22.3 to go 1.24.2) without unintended dependency version bumps.fixes: #20773