axw/gocov

gocov output data format as standard go test does?

Opened this issue · 8 comments

Is it possible to generate output in the same format as standard go test does?
Some tools require output to be in standard go test format, not json. I wonder if there is any limitation to do this. In theory it could be directly generated from json... however I'm not sure if there are any known limitations?

axw commented

@arvenil do you mean the coverage format of "go test"? If you want that format, why not just use "go test -cover ..." directly?

gocov predates "go test -cover", hence a different format; it's now just a wrapper around "go test -cover". Changing the JSON format would break integration with gocov-related tools (goveralls, gocov-xml, etc.)

axw commented

Haven't heard back for a few days, so closing this for now. I don't think there's a reason to use gocov over the standard coverage testing except if you want to use the gocov-related tools.

@axw the problem is that you can't do coverage of multiple packages with standard tools (https://code.google.com/archive/p/go/issues/6909)... gocov solves that but then it doesn't produce standard go format. When it comes to implementation I was actually thinking about gocov generating json like it does now (so no changes to this part) and then adding something like gocov-standard (like go-html) that will convert it back to standard go test format.
On one hand it sounds silly to go back and forth with conversion, on the other hand it doesn't brake anything. The only thing I'm wondering if there are any limitations that would prevent converting json format back to go test -coverprofile like some limitation of the format.

p.s. And yes, I know that there are "scripts" and "tools" that do that but I would like to have one tool for generating coverage report so it's more predictable (btw. pretty awesome library:))

(sorry for delayed answer, I'm having a lot of open questions in all repos :D)

axw commented

@arvenil I see, thanks for the explanation.

I don't have a need for this, but if you would like to work on it then I'll be happy to review it.

Ok, let's close the issue for now. When I will have some time I will try to write such library :)

axw commented

Ok, let's close the issue for now. When I will have some time I will try to write such library :)

No problem. I'll leave this open, in case someone else feels a need for it too.

goveralls doesn't support anymore gocov
mattn/goveralls#64
so now I see even stronger need for such tool :)

This could be useful for us as well. We are trying to use CodeClimate and they don't support the json output.