Code Monkey home page Code Monkey logo

Comments (5)

arvenil avatar arvenil commented on May 18, 2024 1

Hi, @dnephin wrote best summary ever, after dealing with those issues for several years I can confirm there is really nothing much to add. To me gocov is obsolete since we can do now go test -coverprofile=coverage.out -covermode=atomic -coverpkg=./... ./....

Now the only missing thing is test output and coverage output conversion to different formats. This library seems to deal with tests and I'm using https://github.com/t-yuki/gocover-cobertura for coverage. But honestly, for simplification, I really would love to use just one, well maintained, tool. Especially that gocover-cobertura doesn't seem to work really well, there are issues with paths for example. If you guys have ever time or desire to properly handle coverage as well then it would be really amazing.

from gotestsum.

dnephin avatar dnephin commented on May 18, 2024

Thank you for opening this issue!

I was not familiar with gocov or the Cobertura so I had a look. As I understand it, the situation is something like this:

  • As of go1.10 a lot of what gocov does is unnecessary. go test now supports adding a -coverprofile when running with multiple package
  • gocov-xml is close to what you want, except that instead of reading the golang coverage format it reads the gocov JSON

Since the input to the xml is a file created by go test, there is little benefit for that program to be part of gotestsum. It could be a completely separate tool as none of the code would overlap. The only benefit to integrating it in this repo would ease maintenance and installation for users of both tools.

I found https://github.com/t-yuki/gocover-cobertura which seems to be exactly what would be needed. It appears to read the standard go coverage files and output the Cobertura XML format. If I understand correctly the go tool cover command has been included in the standard release since go1.2, so that at least reduces the number of tools to 2.

I'm hesitant to integrate that tool since the code wouldn't benefit from that integration.

from gotestsum.

fdcds avatar fdcds commented on May 18, 2024
* [As of go1.10](https://golang.org/doc/go1.10#test) a lot of what `gocov` does is unnecessary. `go test` now supports adding a `-coverprofile` when running with multiple package

Maybe I am missing something, but Go 1.10 (go test -coverprofile=...) does not make gocov obsolete but actually makes it possible. A small part of gocov is a tiny wrapper around go test -coverprofile=... and the larger part of gocov deals with converting that to this JSON format and some other part converts it into textual form.

Since the input to the xml is a file created by go test, there is little benefit for that program to be part of gotestsum. It could be a completely separate tool as none of the code would overlap. The only benefit to integrating it in this repo would ease maintenance and installation for users of both tools.

ACK

I found https://github.com/t-yuki/gocover-cobertura which seems to be exactly what would be needed. It appears to read the standard go coverage files and output the Cobertura XML format. If I understand correctly the go tool cover command has been included in the standard release since go1.2, so that at least reduces the number of tools to 2.

Thanks for having a look! I must have somehow missed this tool when searching for ways to get the coverage reports into our test analysis.

I'm hesitant to integrate that tool since the code wouldn't benefit from that integration.

ACK

from gotestsum.

dnephin avatar dnephin commented on May 18, 2024

Maybe I am missing something, but Go 1.10 (go test -coverprofile=...) does not make gocov obsolete but actually makes it possible.

It is definitely possible I am wrong. I should elaborate on how I reached this conclusion:

  • Go1.10 was first released on 2018-02-16. gocov dates back to June 2012.

  • Previous to go 1.10 it was not possible to run go test with multiple package if the --coverprofile flag was used. It required that you run every pacakge with a separate go test command. From the go1.10 release notes:

    Also, the go test -coverprofile option is now supported when running multiple tests.

  • Because of this limitation many people used tools like gocov, or bash scripts to run each package separately.

gocov does also provide some help with the reports, however as of Go1.2 (first rleased on 2013-12-01) the go toolchain provides similar functionality: https://golang.org/doc/go1.2#cover.

There may be other features of gocov that I'm missing, but at least the primary features seem to be covered by the go toolchain. The interchange format doesn't seem all that valuable itself if no other tools support it.

I guess maybe the reports it produces may be a better than what the standard go tool cover provide?

from gotestsum.

fdcds avatar fdcds commented on May 18, 2024

Thanks for writing down the history. I only looked at the current page and am not that familiar with the history of the Go ecosystem. From your write up it seems indeed that gocov is a dead-end. Thanks again for the hint regarding gocover-cobertura.

from gotestsum.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.