axw/gocov

Running into "flag provided but not defined: -coverprofile"

ShettyA opened this issue · 3 comments

On running "gocov test ", I run into following errors.

flag provided but not defined: -coverprofile
Usage of /var/folders/zz/4ffrsh1s5vb18wn558p9bw4w001tpw/T/go-build604129205/_/t:
-test.bench="": regular expression to select benchmarks to run
-test.benchmem=false: print memory allocations for benchmarks
-test.benchtime=1s: approximate run time for each benchmark
-test.blockprofile="": write a goroutine blocking profile to the named file after execution
-test.blockprofilerate=1: if >= 0, calls runtime.SetBlockProfileRate()
-test.cpu="": comma-separated list of number of CPUs to use for each test
-test.cpuprofile="": write a cpu profile to the named file during execution
-test.memprofile="": write a memory profile to the named file after execution
-test.memprofilerate=0: if >=0, sets runtime.MemProfileRate
-test.parallel=1: maximum test parallelism
-test.run="": regular expression to select tests and examples to run
-test.short=false: run smaller test suite to save time
-test.timeout=0: if positive, sets an aggregate time limit for all tests
-test.v=false: verbose: print additional output
exit status 2

This was working till a few weeks back. has anything changed recently in gocov command usage?

axw commented

That looks a lot like you're using a version of Go < 1.2. Gocov was changed about 3 months ago to use (and require) the coverage support introduced in Go 1.2.

Thanks, You are right. On upgrading go version from 1.1.1 to 1.2, I am no longer seeing earlier faced errors. But it now looks like I can run gocov for a single package and not for for multiple packages in one command.

On running gocov test <list of packages>, I run into following errors.
"cannot use test profile flag with multiple packages
error: %v exit status 1"

Is there a different way to get gocov working for multiple packages?

axw commented

Unfortunately support for testing multiple packages at once was lost in the move to using the 1.2 coverage features. What I would suggest is to run "go test -coverprofile= " for each package, and then combine all of the profiles into one gocov profile with "gocov convert <profile.0> <profile.1> ... <profile.N>".

I'll close this issue as the original problem is resolved, but feel free to continue the discussion of multiple packages.