rules_go icon indicating copy to clipboard operation
rules_go copied to clipboard

Add support for --@io_bazel_rules_go//go/toolchain:sdk_version flag.

Open JamesMBartlett opened this issue 3 years ago • 2 comments

What type of PR is this? Feature

What does this PR do? Why is it needed? This PR adds a build flag --@io_bazel_rules_go//go/toolchain:sdk_version, that allows changing which go SDK version to use to build targets. Implementation details:

  • Each go_sdk now has config_settings that specify different values of sdk_version. Eg. a go1.17.3 SDK would declare a config_setting for sdk_version="1", sdk_version="1.17", sdk_version="1.17.3", and sdk_version="".
  • Then each toolchain that is registered for an SDK will have a config_setting_group constraint that combines the above config_settings. In the example given above, the go1.17.3 SDK would have a toolchain that only gets selected if sdk_version is 1, 1.17, 1.17.3 or the empty string (default).
  • If sdk_version flag is not specified, then all SDKs can be selected because of the inclusion of the empty string config_setting in the config_setting_group.

Which issues(s) does this PR fix? Partially #3202 Second diff coming to fully close that issue.

Other notes for review See #3202 for more discussion about this feature.

Working with my employer on signing the CLA at the moment.

Signed-off-by: James Bartlett [email protected]

JamesMBartlett avatar Aug 02 '22 23:08 JamesMBartlett

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Aug 02 '22 23:08 google-cla[bot]

@JamesMBartlett If you rebase on master, you should be able to resolve the CI failure by updating the patch in tests/bcr/bcr.patch - if you have trouble doing that, let me know and I will take care of it.

fmeum avatar Aug 03 '22 10:08 fmeum