Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/cover: clarify the format of cover profile generated with go test -coverprofile #40251

Open
hyangah opened this issue Jul 16, 2020 · 0 comments
Open
Labels
Milestone

Comments

@hyangah
Copy link
Contributor

@hyangah hyangah commented Jul 16, 2020

Processing the coverage profile generated from go test -coverprofile to integrate it with editors,
we need clarification of the output format.

The profile looks like

mode: set
mvdan.cc/xurls/v2/xurls.go:56.35,59.25 3 1
...

and the first element of each item (link) is often called FileName, but this is not the true file name.

Code here determines what this is. It is either the import path and the base file name, or the absolute path (isn't it platform dependent?)

See how go tool cover -html=... parses the profile output. Any editor integration work requires to implement the same to associate the coverage info with the source code.

This detail is hidden deep in the source code. We need to document this.
The cover tool documentation can be the first place users would search.

cc @ianthehat @pjweinbgo @jayconrod

@hyangah hyangah changed the title cmd/go: clarify the format of cover profile generated with go test -coverprofile cmd/cover: clarify the format of cover profile generated with go test -coverprofile Jul 16, 2020
@andybons andybons added the NeedsFix label Jul 16, 2020
@andybons andybons added this to the Unplanned milestone Jul 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.