From 26730727af16bbaffd782ffa8ad36be12c1b35b5 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Thu, 15 Feb 2024 21:37:18 +0100 Subject: [PATCH] Make exec cfg check for `//go` stricter (#3867) See https://github.com/bazelbuild/bazel/issues/14444#issuecomment-1945642624. --- go/private/rules/go_bin_for_host.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/private/rules/go_bin_for_host.bzl b/go/private/rules/go_bin_for_host.bzl index 97a7afbdf7..50ef8be4c8 100644 --- a/go/private/rules/go_bin_for_host.bzl +++ b/go/private/rules/go_bin_for_host.bzl @@ -19,7 +19,7 @@ def _ensure_target_cfg(ctx): # A target is assumed to be built in the target configuration if it is neither in the exec nor # the host configuration (the latter has been removed in Bazel 6). Since there is no API for # this, use the output directory to determine the configuration, which is a common pattern. - if "-exec-" in ctx.bin_dir.path or "/host/" in ctx.bin_dir.path: + if "-exec" in ctx.bin_dir.path or "/host/" in ctx.bin_dir.path: fail("//go is only meant to be used with 'bazel run', not as a tool. " + "If you need to use it as a tool (e.g. in a genrule), please " + "open an issue at " +