Skip to content

Unable to open coverage profile using go tool cover with go1.9.2 #170

@pavlo-v-chernykh

Description

@pavlo-v-chernykh

Hi Dmitry,

Thanks for a great tool.

I have faced with the next issue trying to inspect coverage profile gathered by go-fuzz.

go tool cover -html=coverprofile
cover: inconsistent NumStmt: changed from 0 to 1

Some go env stuff

GOARCH="amd64"
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.9.2/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.9.2/libexec/pkg/tool/darwin_amd64"

go-fuzz rev: 490b850

Snippet of cover profile that causes the issue:

fmt/format.go:0.0,1.1 0 0
fmt/format.go:0.0,1.1 1 0

There are a lot of similar lines in the cover profile with different files as well (from std lib and from a project).

I did some investigation and found the place in go tool cover sources:

https://github.com/golang/go/blob/f39050c8ebf894ccedc0b99de96f7412be97af89/src/cmd/cover/profile.go#L94-L119

Also, I think the place in go-fuzz that introduced that 0 statements is

return []ast.Stmt{f.newCounter(pos, blockEnd, 0)}

I would like to fix that issue but do not understand where is the actual problem.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions