You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
709 B

package main
import (
"fmt"
"time"
)
type Shoe struct {
Hamsters uint8
Tacos []string
}
type Cheese struct {
Holes float64
Flavors map[string]string
ShelfLife time.Time
}
func main() {
v := make(map[string]interface{})
v["loafer"] = &Shoe{
Hamsters: uint8(49),
Tacos: []string{"spicy", "crunchy"},
}
flavors := make(map[string]string)
flavors["fruit01"] = "grape"
flavors["fruit02"] = "apple"
v["cheddar"] = &Cheese{
Holes: float64(9.2),
Flavors: flavors,
ShelfLife: time.Date(1999, time.Month(8), 12, 7, 15, 22, 0, time.UTC),
}
fmt.Printf("v = %+v\n", v)
fmt.Printf("v[\"loafer\"] = %+v\n", v["loafer"])
fmt.Printf("v[\"cheddar\"] = %+v\n", v["cheddar"])
}