Anyone familiar with the Go support? I'm wondering...
# general
d
Anyone familiar with the Go support? I'm wondering how to create a
go_binary
with coverage (
go build -cover
https://go.dev/doc/build-cover). https://www.pantsbuild.org/2.19/reference/targets/go_binary I'm not sure whether
-cover
is a linker/compiler/assembler flag, or something else.
f
The "new" coverage introduced in Go 1.20 is not supported yet in Pants. Only coverage in unit tests as supported in previous Go versions.
d
Thank you! Would it be hard to add, if you know? I wouldn't mind contributing it, especially if it's just a matter of adding a new go_binary field
f
It isn't. It involves revamping how the compilation rules work to account for the new style of code generation used to implement the new coverage system in Go.
Since Pants does not use
go build
for compilation but rather the lower level
go tool compile
, Pants must call the code generator itself (which it does for the existing coverage support).
maybe some of the support can be reused, but you likely would be reading through
go
source code to see exactly what
go build
does for the new coverage, and then replicate those steps in Pants.
d
I see, thanks for the information! It sounds like it's probably beyond what I can do in that case