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

Fix go_tool_binary non-hermeticity and Go 1.19 incompatibility #4167

Merged
merged 5 commits into from
Nov 12, 2024

Conversation

fmeum
Copy link
Member

@fmeum fmeum commented Nov 8, 2024

What type of PR is this?

Bug fix

What does this PR do? Why is it needed?

go_tool_binary used to non-hermetically pick up rules_go's go.mod file when run unsandboxed, which resulted in it downloading a different toolchain and messing up version checks.

Also make nogo_main.go compatible with Go 1.19 and test with nogo (which requires fixing a bunch of violations).

Which issues(s) does this PR fix?

Fixes #

Other notes for review

@fmeum fmeum marked this pull request as draft November 8, 2024 09:58
`go_tool_binary` used to non-hermetically pick up rules_go's `go.mod` file when run unsandboxed, which resulted in it downloading a different toolchain and messing up version checks.

Also make `nogo_main.go` compatible with Go 1.19.
@fmeum fmeum force-pushed the go-tool-binary-hermeticity branch from cdca20a to 5170ede Compare November 8, 2024 10:11
@zecke
Copy link
Contributor

zecke commented Nov 9, 2024

Slightly related. Should the go.mod file be passed as dependency? For things like https://go.dev/blog/loopvar-preview the content of the go.mod file seems to determine the behavior.

From a rules_go users point of view. What is the capture behavior now when using Go 1.22+?

@fmeum
Copy link
Member Author

fmeum commented Nov 10, 2024

From a rules_go users point of view. What is the capture behavior now when using Go 1.22+?

rules_go currently always uses the Go language version corresponding to the version of the Go SDK.

Slightly related. Should the go.mod file be passed as dependency? For things like https://go.dev/blog/loopvar-preview the content of the go.mod file seems to determine the behavior.

I started working on this in #4106, but haven't gotten around to finalizing the PR. If anyone wants to take a stab at this, please do.

@fmeum fmeum marked this pull request as ready for review November 11, 2024 17:17
@fmeum fmeum requested review from tyler-french and linzhp November 11, 2024 17:18
go/runfiles/manifest.go Show resolved Hide resolved
@fmeum fmeum merged commit a1a0b60 into master Nov 12, 2024
4 checks passed
@fmeum fmeum deleted the go-tool-binary-hermeticity branch November 12, 2024 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants