I would like cover tool to have flag outputing total coverage that could be then later used in some custom scripts (like in CI).
λ go tool cover -func=coverage.out
slug/slug.go:43: fooA 100.0%
slug/slug.go:49: fooB 100.0%
slug/slug.go:106: fooC 100.0%
total: (statements) 100.0%
# now in script (could break if output format change)
λ go tool cover -func=coverage.out | grep total | grep -Eo '[0-9]+\.[0-9]+'
# some flag idea
λ go tool cover -total-number -func=coverage.out
$ go version
go version go1.16.6 linux/amd64
λ go tool cover -V
cover version go1.16.6
The text was updated successfully, but these errors were encountered:
I think at this point we are happy to say that the output format of go tool cover -func=coverage.out is not going to change.
That seems like a better solution than a separate flag that prints a single number.
(Printing the single number puts too much emphasis on that one metric.)