Open adrienjoly opened 3 years ago
@adrienjoly Thanks for submitting an issue! Do you know what coverage format the go test outputs the results in? We might be able to simply add another parser type to the already existing set (jacoco, cobertura, lcov, etc).
Unfortunately, I believe that Go uses its own format, for coverage reports...
You can find some pointers on how to convert to more standard formats, on this stackoverflow page: https://stackoverflow.com/questions/31413281/golang-coverprofile-output-format/39453143
I have https://facebook.github.io/watchman/ configured to convert the go coverage to lcov format using https://github.com/jandelgado/gcov2lcov
[
"trigger",
".",
{
"name": "coverage",
"expression": [
"anyof",
[
"match",
"go-nmea.coverprofile",
"wholename"
]
],
"command": [
"/home/munnik/go/bin/gcov2lcov",
"-infile=go-nmea.coverprofile",
"-outfile=lcov.info"
]
}
]
This works great and the go-nmea.coverprofile
file gets update the lcov.info
is updated immediately.
@munnik Thanks for that work around, it should help users in the meantime until we get around to implementing the go coverage format natively in the extension! cc @adrienjoly
For anyone coming to this now, who isn't that familiar with watchman
(like myself), the easiest way I found to make use of the workaround above was the watchman-make
[1] command:
watchman-make -p 'coverage.out' --run "gcov2lcov -infile=coverage.out -outfile=lcov.info"
And since I had watchman
already installed I also just left it in the background running the tests on save like so:
watchman-make -p '**/*.go' --run "go test -coverprofile=coverage.out ./..."
1: https://facebook.github.io/watchman/docs/watchman-make.html
@williammartin Thanks for the extra info 👍🏻, I am sure someone will find the above valuable.
Is your feature request related to a problem? Please describe. Go/Golang coverage reports do not seem directly supported by this extension.
Describe the solution you'd like It would be awesome if the extension could understand the report generated by
go test
, out of the box.Describe alternatives you've considered I tested another extension that was supposed to display the coverage of .go files, but it failed with an error message at startup.
Additional context Here's a workaround that I used successfully to make Vscode Coverage Gutters display the coverage of my go files, run the following command:
... then, re-activate the "watch" if necessary. You should get something like that: