Skip to content

Commit

Permalink
enable windows/arm64 go build with bazel (#3072)
Browse files Browse the repository at this point in the history
  • Loading branch information
niyas-sait authored Mar 23, 2022
1 parent 787d76a commit d606ba2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions go/private/platforms.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ GOOS_GOARCH = (
("windows", "386"),
("windows", "amd64"),
("windows", "arm"),
("windows", "arm64"),
)

RACE_GOOS_GOARCH = {
Expand Down Expand Up @@ -135,6 +136,7 @@ CGO_GOOS_GOARCH = {
("solaris", "amd64"): None,
("windows", "386"): None,
("windows", "amd64"): None,
("windows", "arm64"): None,
}

def _generate_constraints(names, bazel_constraints):
Expand Down
6 changes: 5 additions & 1 deletion go/private/sdk.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +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"
goos = "windows"
if ctx.os.environ.get("PROCESSOR_ARCHITECTURE") == "ARM64" or ctx.os.environ.get("PROCESSOR_ARCHITEW6432") == "ARM64":
goarch = "arm64"
else:
goarch = "amd64"
elif ctx.os.name == "freebsd":
goos, goarch = "freebsd", "amd64"
else:
Expand Down

0 comments on commit d606ba2

Please sign in to comment.