-
Notifications
You must be signed in to change notification settings - Fork 634
Description
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.