-
-
Notifications
You must be signed in to change notification settings - Fork 684
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
Allow go sdk selection to factor in GOEXPERIMENT
values
#3582
Comments
Since Go experiments can affect the SDK in essentially arbitrary ways and can be combined, I find it hard to come up with a way to match them directly. What do you think of allowing users to add constraints and @linzhp What do you think of modelling boringcrypto as a target platform constraint? |
I'm still trying to wrap my head around these concepts, but I believe my current attempt it's trying to accomplish what you described (commit). I was essentially trying to model how the Can you explain more on the target platform constraint idea? It's not clear to me if that is an implementation detail of the |
Can we model all experiments as target platform constraints? This allows users to use pre-compiled stdlib with experiments and remove this logic: |
@linzhp and I had an offline discussion about this. While it may make sense to model @ddelnano An approach based on build settings similar to |
@fmeum here is where I've gotten so far. Apologies for the rough shape it's in. I primarily It's currently failing to find a toolchain that matches the new I'm also in the #go Bazel slack. So if it's easier for more real time communication there, I'm happy to talk there as well. |
Matching individual experiments seems difficult and the semantics aren't super clear: Most experiments have a Could you try matching the value of a single |
If I understand this issue correctly, then it's about implementing a Minimal Version Selection for Go SDK based on the matching experiments. BzlMod and Go Modules have implemented similar techniques to manage external dependencies. The main problems I can see with this issue are:
|
I would like to avoid the complexity that full support for (partially) matching experiments would entail, as @sluongng described. If we restrict ourselves to matching the exact list of strings, we would still allow users to select between otherwise identical SDKs, but avoid essentially all of these difficult questions. |
sorry, ignore previous comment, misunderstood the discussion for a second. |
…pecific Go toolchain (#4242) **What type of PR is this?** Feature **What does this PR do? Why is it needed?** This commit adds a new setting --@io_bazel_rules_go//go/toolchain:sdk_name which can be used to select a registered Go toolchain via the name provided in go_download_sdk, go_wrap_sdk, etc. This fixes the problem of selecting a toolchain where the same Go version is used, but different experiements are enabled or patches applied. **Which issues(s) does this PR fix?** Fixes #4240 **Other notes for review** Works also as a workaround for #3582
What version of rules_go are you using?
v0.38.1
What version of gazelle are you using?
v0.29.0
What version of Bazel are you using?
6.2.0
Does this issue reproduce with the latest releases of all the above?
Yes since this issue is a request for new functionality.
What operating system and processor architecture are you using?
linux/amd64
Any other potentially useful information about your toolchain?
N/A
What did you do?
The
go_cross_binary
rule supports specifying thesdk_version
. This attribute only permits the go version string, which means that if you want to compile the same binary with and without boringcrypto the two sdks must have a different go version. This is awkward to use since it means we must maintain a heuristic for having two go versions for each minor version we want to test against.The example below shows how this must be done today:
What did you expect to see?
N/A since this is new functionality.
What did you see instead?
I would like for
go_cross_binary
to select the correct sdk for the same version of go depending on whatGOEXPERIMENT
s should be enabled for the given binary. I'm not well versed on how Bazel works internally, but I believe this means that toolchain selection needs to take into account theGOEXPERIMENT
values in addition to the go version string.This is something I'm interested in contributing back to
rules_go
, but I will likely need some direction on where this could be implemented and a high level of what needs to be accomplished.The text was updated successfully, but these errors were encountered: