Skip to content

Commit

Permalink
Support GODEBUG env-var
Browse files Browse the repository at this point in the history
Summary: Support setting [GODEBUG](https://go.dev/doc/godebug) on toolchain level

Reviewed By: leoleovich

Differential Revision: D53769175

fbshipit-source-id: 5a685f74ff9ad44a22f7fe2271a232697836132f
  • Loading branch information
podtserkovskiy authored and facebook-github-bot committed Feb 15, 2024
1 parent 19a857b commit a1226c6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion prelude/go/toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ GoToolchainInfo = provider(
"env_go_os": provider_field(typing.Any, default = None),
"env_go_arm": provider_field(typing.Any, default = None),
"env_go_root": provider_field(typing.Any, default = None),
"env_go_debug": provider_field(dict[str, str], default = {}),
"external_linker_flags": provider_field(typing.Any, default = None),
"filter_srcs": provider_field(typing.Any, default = None),
"go": provider_field(typing.Any, default = None),
Expand All @@ -50,7 +51,9 @@ def get_toolchain_cmd_args(toolchain: GoToolchainInfo, go_root = True, force_dis
cmd.add("GOARM={}".format(toolchain.env_go_arm))
if go_root and toolchain.env_go_root != None:
cmd.add(cmd_args(toolchain.env_go_root, format = "GOROOT={}"))

if toolchain.env_go_debug:
godebug = ",".join(["{}={}".format(k, v) for k, v in toolchain.env_go_debug.items()])
cmd.add("GODEBUG={}".format(godebug))
if force_disable_cgo:
cmd.add("CGO_ENABLED=0")
else:
Expand Down

0 comments on commit a1226c6

Please sign in to comment.