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 default value for GOTOOLCHAIN env variable #420

Closed
gaby opened this issue Aug 31, 2023 · 7 comments
Closed

Update default value for GOTOOLCHAIN env variable #420

gaby opened this issue Aug 31, 2023 · 7 comments
Assignees
Labels
feature request New feature or request to improve the current logic investigation The issue is under investigation

Comments

@gaby
Copy link

gaby commented Aug 31, 2023

With the release of go1.21 the behavior for running changed, by default go will now use GOTOOLCHAIN=auto which will fail to run your code unless you do go mod tidy if the go version specified in go.mod is older than the one in setup-go.

One fix for this is to set GOTOOLCHAIN=local, so that go doesn't try to force update your toolchain. Add support for specifying the GOTOOLCHAIN, or set it to GOTOOLCHAIN=local by default.

Docs:

@gaby gaby added feature request New feature or request to improve the current logic needs triage labels Aug 31, 2023
@dsame
Copy link
Contributor

dsame commented Aug 31, 2023

Hello @gaby , thank you for your input. We start to investigate the problem.

@dsame dsame added investigation The issue is under investigation and removed needs triage labels Aug 31, 2023
@gaby
Copy link
Author

gaby commented Aug 31, 2023

@dsame Thanks! I don't expect the Go team to change this default value.

@gaby
Copy link
Author

gaby commented Sep 1, 2023

Also related: golang/go#62409

@dsame dsame self-assigned this Sep 1, 2023
@dsame
Copy link
Contributor

dsame commented Sep 1, 2023

Hello @gaby,

Despite the specifying GOTOOLCHAIN is as easy as any other environment variables
https://docs.github.com/en/actions/learn-github-actions/variables#defining-environment-variables-for-a-single-workflow

i still do not understand the problem well, namely why this can be happen:

will fail to run your code unless you do go mod tidy if the go version specified in go.mod is older than the one in setup-go.

according the documentation of Go the newer toolchain will be used in this case. I.e. go.mod version will be ignored see " the new toolchain would be used automatically"

Can you please provide the sample where the build filed because of setup-go version is newer than the version set in go.mod?

And does it help to set GOTOOLCHAIN to the desired value for the workflow manually? So far my understanding is the default value "auto" works best in the most cases.

@gaby
Copy link
Author

gaby commented Sep 2, 2023

@gaby
Copy link
Author

gaby commented Sep 2, 2023

@dsame Closing this, the issue was caused by a dependency requiring go 1.21

The explanation can be found here golang/go#62409 (comment)

Thanks for your help!

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 investigation The issue is under investigation
Projects
None yet
Development

No branches or pull requests

2 participants