Skip to content
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

feat(manager/gomod): Added support for the gomod toolchain directive #27279

Merged

Conversation

kvanzuijlen
Copy link
Contributor

@kvanzuijlen kvanzuijlen commented Feb 13, 2024

Changes

Added support for the go.mod toolchain directive to the gomod manager.

Context

Go 1.21 introduced the toolchain directive. This directive, contrary to the go directive, should be updated by Renovate, see #24427 and #16715. Closes #24427

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
lib/modules/manager/gomod/extract.ts Show resolved Hide resolved
lib/modules/manager/gomod/extract.ts Show resolved Hide resolved
lib/modules/manager/gomod/update.ts Outdated Show resolved Hide resolved
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
@kvanzuijlen
Copy link
Contributor Author

I'll rerun against the repository to be 100% sure.

@kvanzuijlen
Copy link
Contributor Author

I'll rerun against the repository to be 100% sure.

Ran and verified! Updated the PR description to link to the new PR.

@rarkins
Copy link
Collaborator

rarkins commented Feb 14, 2024

Related to this PR, does this mean that Renovate should use the tool chain directive as the source of truth for which version of go to install/run ?

@kvanzuijlen
Copy link
Contributor Author

kvanzuijlen commented Feb 14, 2024

Related to this PR, does this mean that Renovate should use the tool chain directive as the source of truth for which version of go to install/run ?

@rarkins As far as I understand, the go-binary itself will take care of that, see https://go.dev/doc/toolchain#select

@rarkins
Copy link
Collaborator

rarkins commented Feb 14, 2024

Related to this PR, does this mean that Renovate should use the tool chain directive as the source of truth for which version of go to install/run ?

@rarkins As far as I understand, the go-binary itself will take care of that

So we'll continue installing the latest go, as we do today? Technically we install the latest matching "^[go mod directive value]" but that's the same thing as latest.

@kvanzuijlen
Copy link
Contributor Author

Related to this PR, does this mean that Renovate should use the tool chain directive as the source of truth for which version of go to install/run ?

@rarkins As far as I understand, the go-binary itself will take care of that

So we'll continue installing the latest go, as we do today? Technically we install the latest matching "^[go mod directive value]" but that's the same thing as latest.

As long as that is go 1.21+ that should be fine yes

@rarkins
Copy link
Collaborator

rarkins commented Mar 18, 2024

@kvanzuijlen do you have time to continue this?

Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

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

please add the depType as suggested

@kvanzuijlen
Copy link
Contributor Author

@kvanzuijlen do you have time to continue this?

Yes, I will continue with it early next week!

Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

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

otherwise LGTM

lib/modules/manager/gomod/extract.ts Outdated Show resolved Hide resolved
@viceice viceice requested a review from secustor March 29, 2024 21:25
@kramvan1
Copy link

@kvanzuijlen Not sure I follow the code, but need to only update the toolchain if it already exists in the go.mod, I don't think renovate should ever add it directly.

@kvanzuijlen
Copy link
Contributor Author

@kvanzuijlen Not sure I follow the code, but need to only update the toolchain if it already exists in the go.mod, I don't think renovate should ever add it directly.

It doesn't, it checks for a line starting with toolchain go and if it exists it extracts the version if it exists unless I'm misremembering (i'm on my phone now)

@secustor secustor added this pull request to the merge queue Apr 10, 2024
Merged via the queue into renovatebot:main with commit aec0cd8 Apr 10, 2024
37 checks passed
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 37.283.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@kvanzuijlen kvanzuijlen deleted the go-mod-toolchain-directive-support branch April 17, 2024 07:04
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.

Update "toolchain" in go.mod
6 participants