bazelbuild / rules_go

Go rules for Bazel
Apache License 2.0
1.35k stars 635 forks source link

Add exec_compatible_with to @go_sdk//:builder #3943

Closed EdSchouten closed 1 month ago

EdSchouten commented 1 month ago

What type of PR is this?

Bug fix

What does this PR do? Why is it needed?

go_tool_binary() is completely oblivious of toolchains. The reason being that Go toolchains actually depend on their output. Adding a toolchain dependency would thus add a cyclic dependency. This is problematic, because it means that the actions with mnemonic GoToolchainBinaryBuild end up getting scheduled on arbitrary workers.

Address this by adding exec_compatible_with to the locations where go_tool_binary() is instantiated, namely the auto-generated BUILD files that are part of Go SDKs.

Which issues(s) does this PR fix?

Fixes: #3942

Other notes for review