https://pantsbuild.org/ logo
d

dazzling-petabyte-91122

05/10/2022, 1:28 PM
Trying to find info but coming up short. Is there a way to pass ldflags to the Go backend like with pants v1?
1
f

fast-nail-55400

05/10/2022, 1:29 PM
What’s the use case? cgo?
d

dazzling-petabyte-91122

05/10/2022, 1:58 PM
cgo and passing variable overrides
but most importantly, trying to just create a statically linked binary
f

fast-nail-55400

05/10/2022, 1:59 PM
The v2 Go backend does not currently support cgo. https://github.com/pantsbuild/pants/issues/14338
d

dazzling-petabyte-91122

05/10/2022, 1:59 PM
ok
f

fast-nail-55400

05/10/2022, 2:00 PM
I had started work on cgo support, but all it is currently is a very messy in-progress local branch.
d

dazzling-petabyte-91122

05/10/2022, 2:00 PM
ah ok. Is there a way to create statically linked binaries?
f

fast-nail-55400

05/10/2022, 2:00 PM
And working on that branch has stalled since it is not currently a part of any of my current priorities.
Re linker flags, the Go backend does not currently provide a way to set them. Adding them is straight-forward enough to do for a suitably motivated contributor since it would just involve adding an option and then using that option in the applicable invocation of
go tool link
.
d

dazzling-petabyte-91122

05/10/2022, 2:03 PM
ok sounds good, thanks!
f

fast-nail-55400

05/10/2022, 2:04 PM
so if you want to be that “suitably motivated contributor”, let me know and I can point at what changes to Pants are necessary.
👍 2
4 Views