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

Update "toolchain" in go.mod #24427

Closed
rarkins opened this issue Sep 14, 2023 Discussed in #24419 · 12 comments · Fixed by #27279
Closed

Update "toolchain" in go.mod #24427

rarkins opened this issue Sep 14, 2023 Discussed in #24419 · 12 comments · Fixed by #27279
Assignees
Labels
auto:reproduction A minimal reproduction is necessary to proceed manager:gomod Go Modules priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:feature Feature (new functionality)

Comments

@rarkins
Copy link
Collaborator

rarkins commented Sep 14, 2023

Discussed in #24419

Originally posted by dornimaug September 14, 2023

Tell us more.

Starting with Go 1.21 there is a new directive in go.mod called "toolchain", which can be used to declare the actual toolchain used to build a module in forward compatible way. See https://go.dev/blog/toolchain and https://go.dev/doc/toolchain.
This is not the same thing as the "go" directive, which Renovate already can update. But that was disabled by default in #16715 because it turned out to not be "go tools version" as originally thought but more of a compatibility statement.
The "toolchain" directive provides a way to update the go tools used to build a module transparently during the build process, without touching its compatibility statement expressed by the "go" directive or having to install any newer version of go manually in the build environment. So I think this can and even should be updated if a new version of the go tools is available and it would be useful if Renovate could perform that update.
I do not think it is able to do so now. See https://github.com/dornimaug/renovate-golang-toolchain/blob/main/go.mod#L5 for a reproducer repo.

Another discussion was started in August referencing this topic: #23824 but this ultimately was not about the "toolchain" directive at all, but the "go" directive.

Would you consider implementing toolchain updating?

@rarkins rarkins added type:feature Feature (new functionality) priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others manager:gomod Go Modules status:ready labels Sep 14, 2023
@sheldonhull
Copy link

This is important as the new toolchain directive simplifies updating to newer Go versions for the building, while the compatibility version can stay the same.

The repos that have updated the latest now fail on Go updates due to this directive being invalid.

I'm using "binarySource": "docker" which has been working up till this directive.

CleanShot 2024-01-10 at 12 16 42@2x

@rarkins
Copy link
Collaborator Author

rarkins commented Jan 10, 2024

Please create a minimal reproduction demonstrating such a failed update so we can test against it

@rarkins rarkins added the auto:reproduction A minimal reproduction is necessary to proceed label Jan 10, 2024
Copy link
Contributor

Hi there,

Get your discussion fixed faster by creating a minimal reproduction. This means a repository dedicated to reproducing this issue with the minimal dependencies and config possible.

Before we start working on your issue we need to know exactly what's causing the current behavior. A minimal reproduction helps us with this.

To get started, please read our guide on creating a minimal reproduction.

We may close the discussion if you, or someone else, haven't created a minimal reproduction within two weeks. If you need more time, or are stuck, please ask for help or more time in a comment.

Good luck,

The Renovate team

@kvanzuijlen
Copy link
Contributor

@rarkins can you assign this issue to me?

@renovate-release
Copy link
Collaborator

🎉 This issue has been resolved in version 37.283.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@database64128
Copy link

This does not appear to work. Renovate still ignores the toolchain line and forcibly bumps the go line: database64128/tfo-go@4074a20 (https://github.com/database64128/renovate-config/blob/812dbffc3e53a061e42f47c51d6de2e8f3ef14ed/go.json). #16715 should probably be reopened as well.

@rarkins
Copy link
Collaborator Author

rarkins commented Apr 17, 2024

@database64128 please create a new discussion and minimal reproduction to demonstrate

@dornimaug
Copy link

I can confirm, that no pr or branch is created for my reproducer repository (see original post) even though renovate scans a dependency for the toolchain.
renovate-golang-toolchain.log.

According to the dashboard the update is pending: dornimaug/renovate-golang-toolchain#2

How would one enable this to actually update the toolchain?

@kvanzuijlen
Copy link
Contributor

kvanzuijlen commented Apr 17, 2024

See #28465. Basically I introduced a bug when changing the depType during the PR process (and thanks for the fork I used for my reproduction repository 😀)

@database64128
Copy link

@rarkins Opened #28468

@dornimaug
Copy link

See #28465. Basically I introduced a bug when changing the depType during the PR process (and thanks for the fork I used for my reproduction repository 😀)

I can now can confirm that everything is working as expected: dornimaug/renovate-golang-toolchain#3

Thank you for implementing this feature.

@kvanzuijlen
Copy link
Contributor

kvanzuijlen commented Apr 22, 2024

Thanks @rarkins for having a fix ready this quickly! ❤️

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto:reproduction A minimal reproduction is necessary to proceed manager:gomod Go Modules priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:feature Feature (new functionality)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants