axw/gocov

gocov with go1.18 generics

pjohnst5 opened this issue · 3 comments

Hello,

It seems that with go1.18 generics, gocov currently panics:

coverage.out

 mode: set
dnc/internal/cache/refreshlookthrough.go:24.70,26.2 1 1
dnc/internal/cache/refreshlookthrough.go:41.78,47.2 2 1
dnc/internal/cache/refreshlookthrough.go:50.51,54.25 4 1
dnc/internal/cache/refreshlookthrough.go:58.2,59.13 2 1
dnc/internal/cache/refreshlookthrough.go:54.25,57.3 2 1
dnc/internal/cache/refreshlookthrough.go:67.80,72.8 4 1
dnc/internal/cache/refreshlookthrough.go:78.2,81.9 3 1
dnc/internal/cache/refreshlookthrough.go:85.2,88.19 2 1
dnc/internal/cache/refreshlookthrough.go:96.2,97.19 2 1
dnc/internal/cache/refreshlookthrough.go:72.8,74.3 1 1
dnc/internal/cache/refreshlookthrough.go:81.9,84.3 2 1
dnc/internal/cache/refreshlookthrough.go:88.19,90.55 2 1
dnc/internal/cache/refreshlookthrough.go:90.55,94.4 2 1
dnc/internal/cache/refreshlookthrough.go:101.54,105.2 3 1
dnc/internal/cache/refreshlookthrough.go:108.50,112.2 3 1
dnc/internal/cache/refreshlookthrough.go:119.100,121.19 2 1
dnc/internal/cache/refreshlookthrough.go:125.2,127.15 3 1
dnc/internal/cache/refreshlookthrough.go:132.2,132.6 1 1
dnc/internal/cache/refreshlookthrough.go:121.19,124.3 2 0
dnc/internal/cache/refreshlookthrough.go:127.15,131.3 3 0
dnc/internal/cache/refreshlookthrough.go:132.6,133.10 1 1
dnc/internal/cache/refreshlookthrough.go:134.21,135.20 1 0
dnc/internal/cache/refreshlookthrough.go:136.17,137.35 1 1
dnc/internal/cache/refreshlookthrough.go:137.35,140.19 3 1
dnc/internal/cache/refreshlookthrough.go:145.5,145.27 1 1
dnc/internal/cache/refreshlookthrough.go:140.19,142.6 1 0
dnc/internal/cache/refreshlookthrough.go:142.11,144.6 1 1

Trying gocov with this ^ coverage.out file:

panic: interface conversion: ast.Expr is *ast.IndexListExpr, not *ast.Ident

goroutine 1 [running]:
main.(*FuncVisitor).Visit(0xc000239060, {0x5a81d0?, 0xc000204a20?})
        /root/go/pkg/mod/github.com/axw/gocov@v1.0.0/gocov/convert.go:198 +0x58b
go/ast.Walk({0x5a79a8?, 0xc000239060?}, {0x5a81d0?, 0xc000204a20?})
        /usr/local/go/src/go/ast/walk.go:52 +0x62
go/ast.walkDeclList({0x5a79a8, 0xc000239060}, {0xc000236100?, 0xd, 0xc000239060?})
        /usr/local/go/src/go/ast/walk.go:38 +0x91
go/ast.Walk({0x5a79a8?, 0xc000239060?}, {0x5a8180?, 0xc000226200?})
        /usr/local/go/src/go/ast/walk.go:367 +0x1890
main.findFuncs({0xc00020e050, 0x4c})
        /root/go/pkg/mod/github.com/axw/gocov@v1.0.0/gocov/convert.go:153 +0xaf
main.(*converter).convertProfile(0xc000057d50, 0xc00010a340)
        /root/go/pkg/mod/github.com/axw/gocov@v1.0.0/gocov/convert.go:89 +0x139
main.convertProfiles({0xc0000101a0, 0x1, 0xc000074000?})
        /root/go/pkg/mod/github.com/axw/gocov@v1.0.0/gocov/convert.go:48 +0x268
main.main()
        /root/go/pkg/mod/github.com/axw/gocov@v1.0.0/gocov/main.go:70 +0x26c

Any idea what might fix this?

The code itself we can get into if need be, but what seems to be wrong with the coverage.out file to cause the panic?

github.com/axw/gocov v1.0.0

Was fixed by upgrading to v1.1.0, thanks @rbtr