[go: up one dir, main page]

Align gocoverstats results with those of the standard tools

Running against gocoverstats itself:

$ go test -coverprofile=cover.out -covermode=atomic ./...
ok  	gitlab.com/fgmarand/gocoverstats	0.008s	coverage: 90.2% of statements
$ go run . -v -f cover.out
2022/04/30 18:40:01 loaded 3 profiles
gitlab.com/fgmarand/gocoverstats  0.889
Global, unweighted                0.889

Not even taking into account the case of multiple packages, the single-package result should be 0.902 to match standard tools, not 0.889.

Attached are the cover.out and a spreadsheet recalculating the coverage to match the results of the standard tools, to explain the algorithm, which appears to differ from the one used by gocoverstats.

cover-out.ods cover.out

Edited by Frederic G. MARAND