Skip to content

Commit 9fb3198

Browse files
authored
Prefer rfind to rpartition in go_context (#4035)
**What type of PR is this?** Code cleanup **What does this PR do? Why is it needed?** It's a bit faster due to not allocating the array **Which issues(s) does this PR fix?** Fixes # **Other notes for review**
1 parent 0d8e871 commit 9fb3198

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

go/private/context.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ def _check_binary_dep(go, dep, edge):
348348
349349
go_binary and go_test may return providers with useful information for other
350350
rules (like go_path), but go_binary and go_test may not depend on other
351-
go_binary and go_binary targets. Their dependencies may be built in
351+
go_binary and go_test targets. Their dependencies may be built in
352352
different modes, resulting in conflicts and opaque errors.
353353
"""
354354
if (type(dep) == "Target" and
@@ -538,7 +538,7 @@ def go_context(ctx, attr = None):
538538
cgo_tools.ld_dynamic_lib_path,
539539
]
540540
for tool_path in tool_paths:
541-
tool_dir, _, _ = tool_path.rpartition("/")
541+
tool_dir = tool_path[:tool_path.rfind("/")]
542542
path_set[tool_dir] = None
543543
paths = sorted(path_set.keys())
544544
if ctx.configuration.host_path_separator == ":":

0 commit comments

Comments
 (0)