question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for Go/Golang coverage reports

See original GitHub issue

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:

$ go test -v -coverprofile=go-coverage.out -covermode=atomic -coverpkg=./... ./... && go run github.com/richardlt/gocover-cobertura < go-coverage.out > coverage.xml

… then, re-activate the “watch” if necessary. You should get something like that:

image

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
munnikcommented, Apr 25, 2021

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.

0reactions
ryanlukercommented, Mar 28, 2022

@williammartin Thanks for the extra info 👍🏻, I am sure someone will find the above valuable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Started with Code Coverage for Golang - Codecov
This blog post will show you how to get a simple Golang project up and running with tests and code coverage with Codecov....
Read more >
Code Coverage in GoLang
Here, we are going to see some simple coverage reports generated by the coverage tool. First, we use a simple file containing a...
Read more >
Go: tests with HTML coverage report - Kanan Rahimov - Medium
Tests result viewed as an HTML page. No matter what, tests are essential. Coverage reports help us to write better tests. Go has...
Read more >
The cover story
For the new test coverage tool for Go, we took a different approach that avoids dynamic debugging. The idea is simple: Rewrite the...
Read more >
Code coverage | GoLand Documentation
When a file is opened in the editor, each line is highlighted with regard to its code coverage status: Lines executed during simulation...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found