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

Stop registering a Go SDK in the Gazelle submodule #411

Merged
merged 2 commits into from
Nov 16, 2022

Conversation

shs96c
Copy link
Contributor

@shs96c shs96c commented Nov 11, 2022

I'm not sure if this is the best way to solve this problem, but there are two cases where we want to use this repo:

1/ We're developing the repo itself. We should be responsible for
registering the Go toolchain.

2/ We're being used transitively by another module (eg.
contrib_rules_jvm. We should not be responsible for
registering the Go toolchain

Now, in the ideal world, we'd declare the Go SDK as a dev dependency, and everything would be fine. However, we can't do this because there's no way to gate the call to register_toolchain on us being the root module or not.

The workaround? Attempt to use a unique name for the Go SDK that we need and hope that this works as we think it does.

@shs96c shs96c requested a review from achew22 as a code owner November 11, 2022 18:26
@fmeum
Copy link
Contributor

fmeum commented Nov 11, 2022

@shs96c Do you have to add an SDK explicitly? The rules_go module should register an SDK for you that is picked up if no module closer to the root registers a custom one.

This module can be used as a transitive dep, and so we want to
avoid forcing users to futz with their SDKs.
@shs96c
Copy link
Contributor Author

shs96c commented Nov 12, 2022

@fmeum I did not know that. Altering the PR to take this into account.

@shs96c
Copy link
Contributor Author

shs96c commented Nov 12, 2022

Test failures on last_green appear to be something to do with test files not being present in the data section of sh_test. Not sure if it's related, but the test does pass when not using bzlmod

@fmeum
Copy link
Contributor

fmeum commented Nov 12, 2022

@shs96c That's probably on me: bazelbuild/bazel@839ce7f

This was intended to be backwards compatible, I will debug why it isn't.

@leovitch leovitch mentioned this pull request Nov 15, 2022
copybara-service bot pushed a commit to bazelbuild/bazel that referenced this pull request Nov 15, 2022
When run in the context of the bazel-skylib unit test setup, the new repo mapping logic in the Bash runfiles library failed due to a non-matching grep in a pipe. Fix this by using a wrapper around grep throughout that does not exit with exit code 1 if there is no match.

Fixes bazelbuild/bazel-skylib#411 (comment)

Closes #16755.

PiperOrigin-RevId: 488749744
Change-Id: I087b03d9e95ba27a409c551bdc27d0027919a0fe
Wyverald pushed a commit to bazelbuild/bazel that referenced this pull request Nov 15, 2022
When run in the context of the bazel-skylib unit test setup, the new repo mapping logic in the Bash runfiles library failed due to a non-matching grep in a pipe. Fix this by using a wrapper around grep throughout that does not exit with exit code 1 if there is no match.

Fixes bazelbuild/bazel-skylib#411 (comment)

Closes #16755.

PiperOrigin-RevId: 488749744
Change-Id: I087b03d9e95ba27a409c551bdc27d0027919a0fe
ShreeM01 pushed a commit to bazelbuild/bazel that referenced this pull request Nov 15, 2022
When run in the context of the bazel-skylib unit test setup, the new repo mapping logic in the Bash runfiles library failed due to a non-matching grep in a pipe. Fix this by using a wrapper around grep throughout that does not exit with exit code 1 if there is no match.

Fixes bazelbuild/bazel-skylib#411 (comment)

Closes #16755.

PiperOrigin-RevId: 488749744
Change-Id: I087b03d9e95ba27a409c551bdc27d0027919a0fe

Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
@Wyverald
Copy link
Member

@fmeum just to confirm, do you think this change is good? If so, I'll go ahead and merge it

@Wyverald Wyverald requested review from Wyverald and removed request for achew22 November 16, 2022 18:19
@fmeum
Copy link
Contributor

fmeum commented Nov 16, 2022

@Wyverald Yup, the change it's good, it just no longer matches the PR description.

@Wyverald Wyverald changed the title Use a unique name for the Go SDK that we use for ourselves Stop registering a Go SDK in the Gazelle submodule Nov 16, 2022
@Wyverald Wyverald merged commit 5bfcb1a into bazelbuild:main Nov 16, 2022
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