Coverage instrumented binary in tar format

I am trying to create a coverage instrumented binary.
Referring to - Coverage profiling support for integration tests - The Go Programming Language

The example command used here is as below and is creating an exe file-

go build -cover -o myprogram.exe myprogram.go

I was curious if tar/ tgz instrumented binaries could also be created using the -cover flag. Though I tried to change the extension of the file and run the command but ended up getting corrupt files.

My end goal is to create the binary and replace the kubernetes pods in the application to further run automated tests.

Go Version - 1.21.4

1 Like

Could you elaborate on why you need a tar format for this?

Can’t you just generate the binary with go build and then create a Docker image with the instrumented binary in it that executes the binary on start and have a K8s pod use that image?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.