I'm adding some Golang projects to a monorepo. (Bt...
# general
c
I'm adding some Golang projects to a monorepo. (Btw, everyone here is really happy with how Pants handles all Python projects!) I'm experiencing a few problems with file generation. First one is this:
Copy code
$ pants go-generate ::

13:56:18.02 [INFO] Completed: Process `go generate` directives in file: pkg/something.go
13:56:18.02 [ERROR] 1 Exception encountered:

Engine traceback:
  in `go-generate` goal

ProcessExecutionFailure: Process 'Process `go generate` directives in file: pkg/something.go' failed with exit code 1.
stdout:

stderr:
2024/10/09 13:56:18 Loading input failed: GOPATH is not set



Use `--keep-sandboxes=on_failure` to preserve the process chroot for inspection.
This happens on multiple machines; linux and macs. I've put a reproduction repo here: https://github.com/rdeknijf/pants-repro-gogen
GOPATH
is actually set. I've tried setting it "harder" several different ways, but it looks like envvars are completely ignored. How I would debug this? Thanks!
b
I think you need to configure the
[golang]
part in your pants.toml file
e.g
Copy code
[golang]
cgo_enabled = false
cgo_tool_search_paths = ["<PATH>"]
go_search_paths = ["<PATH>"]
minimum_expected_version = "1.21"
c
Thanks, I tried hardcoding that. But it changes nothing. The default value of
<PATH>
should already be fine btw.
b
Yeah. I've added asdf etc since I control my golang versions with that