Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion internal/go_repository.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,21 @@ def _go_repository_tools_impl(ctx):
"GOPATH": str(ctx.path(".")),
# workaround: to find gcc for go link tool on Arm platform
"PATH": ctx.os.environ["PATH"],
# workaround: avoid the Go SDK paths from leaking into the binary
"GOROOT_FINAL": "GOROOT",
# workaround: avoid cgo paths in /tmp leaking into binary
"CGO_ENABLED": "0",
}

for tool in ("fetch_repo", "gazelle"):
args = [go_tool, "install", "github.com/bazelbuild/bazel-gazelle/cmd/{}".format(tool)]
args = [
go_tool, "install",
"-a",
"-ldflags", "-w -s",
"-gcflags", "all=-trimpath=" + env["GOPATH"],
"-asmflags", "all=-trimpath=" + env["GOPATH"],
"github.com/bazelbuild/bazel-gazelle/cmd/{}".format(tool),
]
result = env_execute(ctx, args, environment = env)
if result.return_code:
fail("failed to build {}: {}".format(tool, result.stderr))
Expand Down