diff --git a/go/private/BUILD.sdk.bazel b/go/private/BUILD.sdk.bazel index ecc2a4c7fc..35c5ca1ee9 100644 --- a/go/private/BUILD.sdk.bazel +++ b/go/private/BUILD.sdk.bazel @@ -80,7 +80,7 @@ filegroup( "bin/go*", "src/**", "pkg/**", - "go.env*", + {goenv} ]), ) diff --git a/go/private/sdk.bzl b/go/private/sdk.bzl index 08c6e74c00..c96730521d 100644 --- a/go/private/sdk.bzl +++ b/go/private/sdk.bzl @@ -478,6 +478,9 @@ def _sdk_build_file(ctx, platform, version, experiments): if not "nocoverageredesign" in experiments and not "coverageredesign" in experiments: experiments = experiments + ["nocoverageredesign"] + # TODO(sluongng): Remove this once we drop support for Go 1.20 + include_go_env = pv[1] >= 21 + ctx.template( "BUILD.bazel", ctx.path(ctx.attr._sdk_build_file), @@ -488,6 +491,7 @@ def _sdk_build_file(ctx, platform, version, experiments): "{exe}": ".exe" if goos == "windows" else "", "{version}": version, "{experiments}": repr(experiments), + "{goenv}": "\"go.env\"," if include_go_env else "", }, )