Skip to content

Commit 860925b

Browse files
authored
Avoid Gazelle recognizing an internal repo as a Go SDK repo (#4264)
**What type of PR is this?** > Uncomment one line below and remove others. > > Bug fix > Feature > Documentation > Other **What does this PR do? Why is it needed?** **Which issues(s) does this PR fix?** Fixes #4263 **Other notes for review**
1 parent 1a5cd2e commit 860925b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

go/private/repositories.bzl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ def go_rules_dependencies(force = False):
320320
)
321321

322322
_maybe(
323-
_go_host_compatible_sdk_label,
323+
_go_host_compatible_s_d_k_label,
324324
name = "go_host_compatible_sdk_label",
325325
)
326326

@@ -336,7 +336,10 @@ def _go_host_compatible_sdk_label_impl(ctx):
336336
ctx.file("BUILD.bazel")
337337
ctx.file("defs.bzl", """HOST_COMPATIBLE_SDK = Label("@go_sdk//:ROOT")""")
338338

339-
_go_host_compatible_sdk_label = repository_rule(_go_host_compatible_sdk_label_impl)
339+
# This rule name has to avoid containing both "go_" and "_sdk" as substrings
340+
# due to this check in Gazelle:
341+
# https://github.com/bazelbuild/bazel-gazelle/blob/f08119735757370319d4f8c7653c0805fdae4817/deps.bzl#L92
342+
_go_host_compatible_s_d_k_label = repository_rule(_go_host_compatible_sdk_label_impl)
340343

341344
def _maybe(repo_rule, name, **kwargs):
342345
if name not in native.existing_rules():

0 commit comments

Comments
 (0)