Skip to content

Commit

Permalink
use ctx.os.arch to get architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
niyas-sait committed Mar 22, 2022
1 parent 2415949 commit 92d0012
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions go/private/sdk.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,6 @@ def _sdk_build_file(ctx, platform):
},
)

def _get_env_var(ctx, name, default = ""):
if name in ctx.os.environ:
return ctx.os.environ[name]
else:
return default

def _detect_host_platform(ctx):
if ctx.os.name == "linux":
goos, goarch = "linux", "amd64"
Expand Down Expand Up @@ -282,11 +276,11 @@ def _detect_host_platform(ctx):
# Default to amd64 when uname doesn't return a known value.

elif ctx.os.name.startswith("windows"):
goos, goarch = "windows", "amd64"
if _get_env_var(ctx, "PROCESSOR_ARCHITECTURE") == "ARM64":
goarch = "arm64"
elif _get_env_var(ctx, "PROCESSOR_ARCHITEW6432") == "ARM64":
goos = "windows"
if ctx.os.arch == "aarch64":
goarch = "arm64"
else:
goarch = "amd64"
elif ctx.os.name == "freebsd":
goos, goarch = "freebsd", "amd64"
else:
Expand Down

0 comments on commit 92d0012

Please sign in to comment.