github.com/HaHadaxigua/yaegi@v1.0.1/_test/map29.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"time"
     6  )
     7  
     8  type Item struct {
     9  	Object interface{}
    10  	Expiry time.Duration
    11  }
    12  
    13  func main() {
    14  	items := map[string]Item{}
    15  
    16  	items["test"] = Item{
    17  		Object: "test",
    18  		Expiry: time.Second,
    19  	}
    20  
    21  	item := items["test"]
    22  	fmt.Println(item)
    23  }
    24  
    25  // Output:
    26  // {test 1s}