Skip to content

Commit

Permalink
Avoid Gazelle recognizing an internal repo as a Go SDK repo
Browse files Browse the repository at this point in the history
Fixes #4263
  • Loading branch information
fmeum committed Feb 12, 2025
1 parent 4c47d52 commit 0346aca
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions go/private/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def go_rules_dependencies(force = False):
)

_maybe(
_go_host_compatible_sdk_label,
_go_host_compatible_s_d_k_label,
name = "go_host_compatible_sdk_label",
)

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

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

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

0 comments on commit 0346aca

Please sign in to comment.