Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GO_TOOLCHAIN string to Label and add toolchain param to one more action #3762

Merged
merged 4 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion extras/gomock.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# DO NOT USE IT.

load("//go/private:context.bzl", "go_context")
load("//go/private:common.bzl", "GO_TOOLCHAIN")
load("//go/private:common.bzl", "GO_TOOLCHAIN", "GO_TOOLCHAIN_LABEL")
load("//go/private/rules:wrappers.bzl", go_binary = "go_binary_macro")
load("//go/private:providers.bzl", "GoLibrary")
load("@bazel_skylib//lib:paths.bzl", "paths")
Expand Down Expand Up @@ -79,6 +79,7 @@ def _gomock_source_impl(ctx):
ctx.file.mockgen_tool,
go_ctx.go,
],
toolchain = GO_TOOLCHAIN_LABEL,
command = """
export GOPATH=$(pwd)/{gopath} &&
{cmd} {args} > {out}
Expand Down
4 changes: 2 additions & 2 deletions go/private/actions/compilepkg.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//go/private:common.bzl", "GO_TOOLCHAIN")
load("//go/private:common.bzl", "GO_TOOLCHAIN_LABEL")
load(
"//go/private:mode.bzl",
"link_mode_args",
Expand Down Expand Up @@ -163,5 +163,5 @@ def emit_compilepkg(
executable = go.toolchain._builder,
arguments = [args],
env = go.env,
toolchain = GO_TOOLCHAIN,
toolchain = GO_TOOLCHAIN_LABEL,
)
4 changes: 2 additions & 2 deletions go/private/actions/link.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

load(
"//go/private:common.bzl",
"GO_TOOLCHAIN",
"GO_TOOLCHAIN_LABEL",
"as_set",
"count_group_matches",
"has_shared_lib_extension",
Expand Down Expand Up @@ -210,7 +210,7 @@ def emit_link(
executable = go.toolchain._builder,
arguments = [builder_args, "--", tool_args],
env = go.env,
toolchain = GO_TOOLCHAIN,
toolchain = GO_TOOLCHAIN_LABEL,
)

def _extract_extldflags(gc_linkopts, extldflags):
Expand Down
6 changes: 3 additions & 3 deletions go/private/actions/stdlib.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
load(
"//go/private:common.bzl",
"COVERAGE_OPTIONS_DENYLIST",
"GO_TOOLCHAIN",
"GO_TOOLCHAIN_LABEL",
)
load(
"//go/private:providers.bzl",
Expand Down Expand Up @@ -83,7 +83,7 @@ def _build_stdlib_list_json(go):
executable = go.toolchain._builder,
arguments = [args],
env = _build_env(go),
toolchain = GO_TOOLCHAIN,
toolchain = GO_TOOLCHAIN_LABEL,
)
return out

Expand Down Expand Up @@ -151,7 +151,7 @@ def _build_stdlib(go):
executable = go.toolchain._builder,
arguments = [args],
env = _build_env(go),
toolchain = GO_TOOLCHAIN,
toolchain = GO_TOOLCHAIN_LABEL,
)
return GoStdLib(
_list_json = _build_stdlib_list_json(go),
Expand Down
1 change: 1 addition & 0 deletions go/private/common.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

GO_TOOLCHAIN = "@io_bazel_rules_go//go:toolchain"
GO_TOOLCHAIN_LABEL = Label(GO_TOOLCHAIN)

go_exts = [
".go",
Expand Down
3 changes: 2 additions & 1 deletion go/private/rules/test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ load(
load(
"//go/private:common.bzl",
"GO_TOOLCHAIN",
"GO_TOOLCHAIN_LABEL",
"as_list",
"asm_exts",
"cgo_exts",
Expand Down Expand Up @@ -118,7 +119,7 @@ def _go_test_impl(ctx):
mnemonic = "GoTestGenTest",
executable = go.toolchain._builder,
arguments = [arguments],
toolchain = GO_TOOLCHAIN,
toolchain = GO_TOOLCHAIN_LABEL,
)

test_gc_linkopts = gc_linkopts(ctx)
Expand Down
3 changes: 2 additions & 1 deletion proto/compiler.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ load(
load(
"//go/private:common.bzl",
"GO_TOOLCHAIN",
"GO_TOOLCHAIN_LABEL",
)
load(
"//go/private/rules:transition.bzl",
Expand Down Expand Up @@ -130,7 +131,7 @@ def go_proto_compile(go, compiler, protos, imports, importpath):
progress_message = "Generating into %s" % go_srcs[0].dirname,
mnemonic = "GoProtocGen",
executable = compiler.internal.go_protoc,
toolchain = GO_TOOLCHAIN,
toolchain = GO_TOOLCHAIN_LABEL,
arguments = [args],
env = go.env,
# We may need the shell environment (potentially augmented with --action_env)
Expand Down