package mainimport ( "fmt")func main() { sm := make([]map[int]string, 5) for i := range sm { sm[i] = make(map[int]string) sm[i][1] = "ok" fmt.Println(sm[i]) } fmt.Println(sm)}
输出结果:
map[1:ok]map[1:ok]map[1:ok]map[1:ok]map[1:ok][map[1:ok] map[1:ok] map[1:ok] map[1:ok] map[1:ok]]