allocate
allocate copied to clipboard
A panic occurs when there is a circular reference to the structure
A panic occurs when there is a circular reference to the structure
code
func Test_xxx(t *testing.T) {
type Node struct {
ID int
Next *Node
}
var node Node
err := allocate.Zero(&node)
if err != nil {
panic(err)
}
t.Logf("%+v", node.Next)
}
run test
runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0xc0200f0388 stack=[0xc0200f0000, 0xc0400f0000]
fatal error: stack overflow
runtime stack: