On Fri, Nov 8, 2024 at 9:13 AM 'N Hess' via golang-nuts
<golang-nuts@googlegroups.com> wrote:
>
> gocov 1.2.1 has a bug that makes it report lower module coverages - we had to 
> revert to 1.1.0. Too bad the repo is closed and read-only now.
>
> I can provide a way to reproduce if needed. N

You are replying to a message that is over 12 years old.  The Go
toolchain now provides native coverage support.  See
https://go.dev/blog/cover.

Ian


> On Saturday, July 7, 2012 at 5:42:43 AM UTC-7 Andrew Wilkins wrote:
>>
>> Hi all,
>>
>> I had a scratch to itch, thus I've been working on a coverage tool
>> for Go over the evenings of the past week. I'm aware there's the
>> broken "cov" tool, but for various reasons I didn't attempt to fix it.
>> Gocov is written entirely in Go, and instruments Go source code
>> to achieve coverage reporting.
>>
>> The code is still pretty raw, and poorly documented, but I figured
>> I should let people know about it earlier rather than later, in the
>> event it helps someone.
>>
>> Currently there's only support for simple statement coverage,
>> and only generating text reports. I'm happy to accept patches to
>> extend coverage to add condition coverage, otherwise I'll get to
>> it when I need it. Another obvious enhancement would be to add
>> HTML reports.
>>
>> To install the gocov tool, "go get github.com/axw/gocov/gocov".
>> You can find some basic documentation on the usage at: 
>> https://github.com/axw/gocov
>> There is currently a limitation which means that gocov will only
>> be able to instrument and report on packages outside of
>> GOROOT, so you won't get statistics on standard library
>> packages. Below is an example of gocov's usage, for testing
>> "exp/types", which I have installed into my GOPATH:
>>
>> $ gocov test exp/types > exptypes.json
>> ... a bunch of output from "go test"
>>
>> $ gocov report exptypes.json
>> ...
>> types/exportdata.go      readGopackHeader              69.23% (9/13)
>> types/gcimporter.go      gcParser.expect                  66.67% (4/6)
>> types/gcimporter.go      gcParser.expectKeyword      66.67% (2/3)
>> ...
>>
>> $ gocov annotate exptypes.json types.gcParser.expectKeyword
>> 266             func (p *gcParser) expectKeyword(keyword string) {
>> 267                     lit := p.expect(scanner.Ident)
>> 268                     if lit != keyword {
>> 269 MISS                        p.errorf("expected keyword %s, got %q", 
>> keyword, lit)
>> 270                     }
>> 271             }
>>
>> Feedback welcome. Enjoy.
>>
>> Cheers,
>> Andrew
>
> --
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion visit 
> https://groups.google.com/d/msgid/golang-nuts/41f19a1e-549c-4520-b93b-7805891c8410n%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcWCsymbCqYrN42eMWo3ikej%3DpUn9Sxm4ad4Qx5%3DXCCAaA%40mail.gmail.com.

Reply via email to