Skip to content

Commit

Permalink
Symlink all SDK files with go_local_sdk (#3696)
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
fmeum committed Sep 15, 2023
1 parent 9ebc93c commit 09a206c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions go/private/sdk.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 09a206c

Please sign in to comment.