A Tour of Go Map literals

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)
}
原文地址:https://www.cnblogs.com/ghgyj/p/4055450.html