github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/gnovm/tests/files/panic1.gno (about) 1 package main 2 3 type Test struct { 4 next map[string]*Test 5 } 6 7 func getNewTest() *Test { 8 curr := Test{ 9 next: map[string]*Test{ 10 "test": {}, 11 }, 12 } 13 14 // Assigning a reference to the struct itself within the map 15 curr.next["test"] = &curr 16 17 return &curr 18 } 19 20 func main() { 21 test := getNewTest() 22 panic("here") 23 } 24 25 // Error: 26 // here