panicparse
panicparse copied to clipboard
Empty structs aren't decoded correctly in function arguments.
This is a pretty minor thing, but it confused me enough to make me want to fix it, unless its a harder problem than I'm realizing.
Empty structs are decoded as ..., `` or sometimes as unknown.
I'd be happy to take a stab at this tonight if this is indeed a bug.
Examples:
//go:noinline
func Foo(x struct{}) {
panic("test")
}
func TestFoo(t *testing.T) {
Foo(struct{}{})
}
Results in:
1: running [Created by testing.(*T).Run @ testing.go:1238]
testing testing.go:1143 tRunner.func1.2(*T(#1), func(#2))
testing testing.go:1146 tRunner.func1(*T(#3))
panic.go:965 panic(interface{}(#1))
pp ppl_test.go:16 Foo()
pp pp_test.go:20 TestFoo(*T(#3))
testing testing.go:1193 tRunner(*T(#3), func(0x8952b8))
exit status 2
And
//go:noinline
func Foo(x chan struct{}) {
panic("test")
}
func TestFoo(t *testing.T) {
Foo(nil)
}
Results in:
1: running [Created by testing.(*T).Run @ testing.go:1238]
testing testing.go:1143 tRunner.func1.2(*T(#1), func(#2))
testing testing.go:1146 tRunner.func1(*T(#3))
panic.go:965 panic(interface{}(#1))
pp ppl_test.go:16 Foo(chan <unknown>(0x0))
pp pp_test.go:20 TestFoo(*T(#3))
testing testing.go:1193 tRunner(*T(#3), func(0x8952b8))
exit status 2
I added them to cmd/panic/main.go and the output is so-so from the stdlib. May want to investigate later. I need to fix the CI first though before starting to fix this.
CI is fixed. Just need someone to help here.