From 8e9b23b0e414a0086fda305a7559f12784db3e0c Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Fri, 15 Sep 2023 13:00:50 +0200 Subject: [PATCH] Symlink all SDK files with `go_local_sdk` This is required with Go 1.21.1 as the `go` tool reads the `go.env` at the root of the SDK. Instead of explicitly symlinking that file, symlink all files except for the ones that already exist, e.g. because they were added by another SDK rule wrapped with `go_wrap_sdk`. --- go/private/sdk.bzl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/go/private/sdk.bzl b/go/private/sdk.bzl index 08fc1a9389..7e13aff75b 100644 --- a/go/private/sdk.bzl +++ b/go/private/sdk.bzl @@ -473,8 +473,10 @@ def _remote_sdk(ctx, urls, strip_prefix, sha256): ) def _local_sdk(ctx, path): - for entry in ["src", "pkg", "bin", "lib", "misc"]: - ctx.symlink(path + "/" + entry, entry) + for entry in ctx.path(path).readdir(): + if ctx.path(entry.basename).exists: + continue + ctx.symlink(entry, entry.basename) def _sdk_build_file(ctx, platform, version, experiments): ctx.file("ROOT")