github.com/traefik/yaegi@v0.15.1/_test/struct52.go (about)

     1  package main
     2  
     3  import "fmt"
     4  
     5  type Node struct {
     6  	Name  string
     7  	Child map[string]Node
     8  }
     9  
    10  func main() {
    11  	a := Node{Name: "hello", Child: map[string]Node{}}
    12  	a.Child["1"] = Node{Name: "world", Child: map[string]Node{}}
    13  	fmt.Println(a)
    14  	a.Child["1"].Child["1"] = Node{Name: "sunshine", Child: map[string]Node{}}
    15  	fmt.Println(a)
    16  }
    17  
    18  // Output:
    19  // {hello map[1:{world map[]}]}
    20  // {hello map[1:{world map[1:{sunshine map[]}]}]}