goimports only works with go binary on the host path when cgo is involved
rmohr opened this issue · 1 comments
rmohr commented
When defining goimports for example like this:
goimports(
name = "goimports",
display_diffs = True,
exclude_paths = [
"./vendor/*",
"./.history/*",
"./.git/*",
"./_ci-configs/*",
],
local = ["kubevirt.io"],
prefix = "kubevirt.io/kubevirt",
write = True,
)
and executing it on a file which needs cgo
, one gets
err: go command required, not found: exec: "go": executable file not found in $PATH: stderr:
if go is not installed on the host. It would be great if goimports
could just pick up the go sdk from rules_go
.
rmohr commented
I think here the interesting line: https://github.com/golang/tools/blob/master/internal/gocommand/invoke.go#L205.