前往:使用地图阵列建立地图

I'm trying to create a map with an array containing maps. My code:

Go:

func main() {
    m := map[string][]map[string]string{
        "photos": [{"a":"1"}, {"b": "2"}],
        "pictures": [{"a":"1"}, {"b": "2"}]
        }
    fmt.Println(m)
}

What is wrong with this? Is this possible?

http://play.golang.org/p/UkokGzvtGL

  1. No Square brackets
  2. Always comma at the end of the line

http://play.golang.org/p/USm9kqDANn

package main

import "fmt"

func main() {
    m := map[string][]map[string]string{
        "photos":   {{"a": "1"}, {"b": "2"}},
        "pictures": {{"a": "1"}, {"b": "2"}},
    }
    fmt.Println(m)
}