diff --git a/go/private/actions/binary.bzl b/go/private/actions/binary.bzl index 6c96699572..538485146f 100644 --- a/go/private/actions/binary.bzl +++ b/go/private/actions/binary.bzl @@ -15,6 +15,8 @@ load( "//go/private:common.bzl", "ARCHIVE_EXTENSION", + "goos_to_extension", + "goos_to_shared_extension", "has_shared_lib_extension", ) load( @@ -40,14 +42,15 @@ def emit_binary( archive = go.archive(go, source) if not executable: - extension = go.exe_extension if go.mode.link == LINKMODE_C_SHARED: name = "lib" + name # shared libraries need a "lib" prefix in their name - extension = go.shared_extension + extension = goos_to_shared_extension(go.mode.goos) elif go.mode.link == LINKMODE_C_ARCHIVE: extension = ARCHIVE_EXTENSION elif go.mode.link == LINKMODE_PLUGIN: - extension = go.shared_extension + extension = goos_to_shared_extension(go.mode.goos) + else: + extension = goos_to_extension(go.mode.goos) executable = go.declare_file(go, path = name, ext = extension) go.link( go, diff --git a/go/private/context.bzl b/go/private/context.bzl index 37f3494978..b5c2d1bbcf 100644 --- a/go/private/context.bzl +++ b/go/private/context.bzl @@ -49,8 +49,6 @@ load( "COVERAGE_OPTIONS_DENYLIST", "GO_TOOLCHAIN", "as_iterable", - "goos_to_extension", - "goos_to_shared_extension", "is_struct", ) load( @@ -569,8 +567,6 @@ def go_context(ctx, attr = None): sdk_root = toolchain.sdk.root_file, sdk_tools = toolchain.sdk.tools, actions = ctx.actions, - exe_extension = goos_to_extension(mode.goos), - shared_extension = goos_to_shared_extension(mode.goos), cc_toolchain_files = cc_toolchain_files, package_list = toolchain.sdk.package_list, importpath = importpath, diff --git a/go/toolchains.rst b/go/toolchains.rst index c71498db17..876c57915a 100644 --- a/go/toolchains.rst +++ b/go/toolchains.rst @@ -591,16 +591,6 @@ Fields | The actions structure from the Bazel context, which has all the methods for building new | | bazel actions. | +--------------------------------+-----------------------------------------------------------------+ -| :param:`exe_extension` | :type:`string` | -+--------------------------------+-----------------------------------------------------------------+ -| The suffix to use for all executables in this build mode. Mostly used when generating the output | -| filenames of binary rules. | -+--------------------------------+-----------------------------------------------------------------+ -| :param:`shared_extension` | :type:`string` | -+--------------------------------+-----------------------------------------------------------------+ -| The suffix to use for shared libraries in this build mode. Mostly used when | -| generating output filenames of binary rules. | -+--------------------------------+-----------------------------------------------------------------+ | :param:`cc_toolchain_files` | :type:`list of File` | +--------------------------------+-----------------------------------------------------------------+ | The files you need to add to the inputs of an action in order to use the cc toolchain. |