Map literals are like struct literals, but the keys are required.
package main import "fmt" type Vertex struct { Lat, Long float64 } var m = map[string]Vertex { "Bell Labs": Vertex { 40.6833, -74.39967, }, "Google": Vertex{ 37.42202, -122.08408, }, } func main() { fmt.Println(m) }
时间: 2024-10-22 18:41:08