Map literals continued

If the top-level type is just a type name, you can omit it from the elements of the literal.

map-literals-continued.go

  1. package main
  2. import "fmt"
  3. type Vertex struct {
  4. Lat, Long float64
  5. }
  6. var m = map[string]Vertex{
  7. "Bell Labs": {40.68433, -74.39967},
  8. "Google": {37.42202, -122.08408},
  9. }
  10. func main() {
  11. fmt.Println(m)
  12. }