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

Allow using toolchain directive from mod file #543

Closed
anuraaga opened this issue Jan 23, 2025 · 3 comments
Closed

Allow using toolchain directive from mod file #543

anuraaga opened this issue Jan 23, 2025 · 3 comments
Labels
feature request New feature or request to improve the current logic

Comments

@anuraaga
Copy link

Description:

Currently, mod files are parsed only for go directive.

https://github.com/actions/setup-go/blob/main/src/installer.ts#L467

It would be good if there were an option to use toolchain directive instead.

Justification:

The go directive is the minimum version of Go supported by a module. If it uses a newer version of Go for building, for example to support new language features in an optional way, it can define a toolchain directive. In this way, the toolchain directive is actually the Go supposed to be used for commands and seems appropriate for setup-go. Note that if using the go directive as current, the older version of Go will be prepared by setup-go, and the go command will then automatically download the version in toolchain and switch to it anyways. This is wasteful and in some situations such as go run can cause some errors.

Are you willing to submit a PR?

If we can decide on the approach, such as config property, and whether the new version could be made the default (IMO it can on a major version bump of setup-go), I can.

@anuraaga anuraaga added feature request New feature or request to improve the current logic needs triage labels Jan 23, 2025
@priya-kinthali
Copy link

Hello @anuraaga 👋,
Thank you for this feature request. We will investigate it and get back to you as soon as we have some feedback.

@AlekSi
Copy link

AlekSi commented Jan 27, 2025

That looks like a subset of #457

@anuraaga
Copy link
Author

Thanks, I missed that and it is indeed a duplicate. Unfortunate since it seems a long standing issue despite being pretty simple in general.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request to improve the current logic
Projects
None yet
Development

No branches or pull requests

3 participants