Skip to content

Commit 38fe4be

Browse files
committed
Stop using Label.workspace_name
According to the Bazel documentation, it is deprecated. Label.repo_name should be used instead. https://bazel.build/rules/lib/builtins/Label#workspace_name
1 parent b1f9017 commit 38fe4be

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

go/private/context.bzl

+1-1
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ def _infer_importpath(ctx, embeds, importpath, importmap):
413413
def matches_scope(label, scope):
414414
if scope == "all":
415415
return True
416-
if scope.workspace_name != label.workspace_name:
416+
if scope.repo_name != label.repo_name:
417417
return False
418418
if scope.name == "__pkg__":
419419
return scope.package == label.package

go/private/extensions.bzl

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def _go_sdk_impl(ctx):
129129
for scope in nogo_tag.includes + nogo_tag.excludes:
130130
# Validate that the scope references a valid, visible repository.
131131
# buildifier: disable=no-effect
132-
scope.workspace_name
132+
scope.repo_name
133133
if scope.name != "__pkg__" and scope.name != "__subpackages__":
134134
fail(
135135
"go_sdk.nogo: all entries in includes and excludes must end with ':__pkg__' or ':__subpackages__', got '{}' in".format(scope.name),

go/private/rules/test.bzl

+3-3
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ def _go_test_impl(ctx):
107107

108108
# now generate the main function
109109
repo_relative_rundir = ctx.attr.rundir or ctx.label.package or "."
110-
if ctx.label.workspace_name:
111-
# The test is contained in an external repository (Label.workspace_name is always the empty
110+
if ctx.label.repo_name:
111+
# The test is contained in an external repository (Label.repo_name is always the empty
112112
# string for the main repository, which is the canonical repository name of this repo).
113113
# The test runner cd's into the directory corresponding to the main repository, so walk up
114114
# and then down.
115-
run_dir = "../" + ctx.label.workspace_name + "/" + repo_relative_rundir
115+
run_dir = "../" + ctx.label.repo_name + "/" + repo_relative_rundir
116116
else:
117117
run_dir = repo_relative_rundir
118118

0 commit comments

Comments
 (0)