gocov icon indicating copy to clipboard operation
gocov copied to clipboard

gocov output data format as standard go test does?

Open arvenil opened this issue 9 years ago • 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?

arvenil avatar Jan 29 '16 13:01 arvenil

@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 avatar Jan 30 '16 07:01 axw

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 avatar Feb 02 '16 00:02 axw

@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)

arvenil avatar Feb 02 '16 10:02 arvenil

@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.

axw avatar Feb 02 '16 10:02 axw

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

arvenil avatar Feb 02 '16 12:02 arvenil

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.

axw avatar Feb 02 '16 23:02 axw

goveralls doesn't support anymore gocov https://github.com/mattn/goveralls/pull/64 so now I see even stronger need for such tool :)

arvenil avatar Mar 28 '16 09:03 arvenil

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

TheRaven avatar Aug 11 '17 12:08 TheRaven