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

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