allocate icon indicating copy to clipboard operation
allocate copied to clipboard

A panic occurs when there is a circular reference to the structure

Open voctior opened this issue 3 years ago • 0 comments

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:

voctior avatar Jun 14 '22 07:06 voctior