Skip to content

Commit 117e85b

Browse files
authored
Do not pass GOOS and GOARCH when installing whydeadcode (#54083)
<!--Please give us some feedback on your experience writing this PR ! https://app.datadoghq.com/forms/43db4c02-6837-400c-8083-692e141b1b88 !--> ### What does this PR do? Do not pass GOOS and GOARCH when installing whydeadcode ### Motivation Fix failure when cross compiling. ### Describe how you validated your changes CI ### Additional Notes Co-authored-by: pierre.gimalac <pierre.gimalac@datadoghq.com>
1 parent a742b0f commit 117e85b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

tasks/libs/common/go.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,9 @@ def _handle_pipe_to_whydeadcode(ctx: Context, name: str, cmd: str, env: dict[str
212212
# worst case it's already installed and nothing happens
213213
with ctx.cd("internal/tools"):
214214
# pass the env to the command so that it can check GOPATH/GOBIN if provided
215-
ctx.run("go install github.com/aarzilli/whydeadcode", env=env)
215+
# ensure GOOS and GOARCH will be resolved to the host's values to avoid cross-compiling whydeadcode itself
216+
local_env = {**(env or {}), "GOOS": "", "GOARCH": ""}
217+
ctx.run("go install github.com/aarzilli/whydeadcode", env=local_env)
216218

217219
# whydeadcode prints unexpected input on stderr (eg. build warnings), and
218220
# dead code call stack on stdout

0 commit comments

Comments
 (0)