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

in v3 setup-go does not set GOROOT #278

Closed
shoenig opened this issue Oct 17, 2022 · 9 comments
Closed

in v3 setup-go does not set GOROOT #278

shoenig opened this issue Oct 17, 2022 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@shoenig
Copy link

shoenig commented Oct 17, 2022

We are running into this after trying to fix the deprecation warnings named in https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

As @godcong noted at the bottom of #276

The setting of GOROOT is not happening anymore.
This is breaking builds where we depend on $GOROOT being set and on the $PATH.

@e-korolevskii
Copy link
Contributor

Hello @shoenig!

Could you please provide a public repository to reproduce the issue?

@shoenig
Copy link
Author

shoenig commented Oct 17, 2022

Hi @e-korolevskii , I created this PR against a sample repository just to reproduce this issue

shoenig/setup-go-example#1

We can see in the v1 version, GOROOT is /opt/hostedtoolcache/go/1.19.1/x64

And in the v3 version, GOROOT is (empty string)

The part where we set GOBIN=GOROOT/bin is just demonstrating why our builds are failing - we make use of GOROOT/bin as a user writable directory on PATH we can install Go tooling into to perform the build.

@dmitry-shibanov
Copy link
Contributor

Hello @shoenig. The GOROOT was removed in this pull request. #175

@shoenig
Copy link
Author

shoenig commented Oct 17, 2022

@dmitry-shibanov what is the suggested workaround, then? We were using that exported environment variable, as it is particularly useful on Windows builders where mangling PATH is tedious.

@urica12
Copy link

urica12 commented Oct 17, 2022

Okay

@godcong
Copy link

godcong commented Oct 18, 2022

This only leads to some compatibility problems, manually modified on the good.
I upgraded from setup@v1, and at first I thought action failed.
Then I changed all the places that use GOROOT and it was fine.

I think it should be reminded in README.md.

@shoenig
Copy link
Author

shoenig commented Oct 18, 2022

I had a thought - what if setup-go automatically exported GOBIN to a useful path - one that is writeable by the actions user and is also added to the $PATH?

That's really what we're trying to get at in our use of $GOROOT/bin, but doesn't have a problem with multiple Go installations.

@e-korolevskii
Copy link
Contributor

Hello @shoenig!

As mentioned earlier, removing GOROOT was not a bug, but an expected behavior.
However, if you still need some env options, I would recommend that you use the go env command to get the needed env option.

In the meantime, I will close this issue, feel free to ask additional questions here or create a new one.

@shoenig
Copy link
Author

shoenig commented Nov 16, 2022

In case anyone else runs into this, we created https://github.com/hashicorp/setup-golang to get the behavior we really wanted (export a GOBIN on PATH)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants