38 lines
709 B
Go
38 lines
709 B
Go
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"])
|
|
}
|