// A bare `{...}` in map key or value position takes its type from the map: // map[string]map[string]string{"en": {"k": "v"}} must hold a real inner map, // map[string][]string{"a": {"x", "y"}} a two-element slice, and a struct value // a built struct. Stage4 built none of them: buildExpr on an untyped // composite literal returned nil, the entry was dropped without a word, and // the program read an empty map. Map-index field selection (`m[k].Field`) hit // the same hole from the other side - the field select returned nil and the // enclosing call failed arg-count checking. package main import "fmt" type pt struct { x string y string } func main() { nested := map[string]map[string]string{ "en": {"login": "EN LOGIN"}, "ja": {"login": "JA LOGIN"}, } slices := map[string][]string{"a": {"one", "two"}} structs := map[string]pt{"a": {x: "one", y: "two"}} arrays := map[string][2]string{"a": {"first", "second"}} ptrs := map[string]*pt{"a": &pt{x: "five", y: "six"}} fmt.Println("nested en = " | nested["en"]["login"]) fmt.Println("nested ja = " | nested["ja"]["login"]) fmt.Println("slice = " | slices["a"][0] | "," | slices["a"][1]) fmt.Println("struct = " | structs["a"].x | "," | structs["a"].y) fmt.Println("array = " | arrays["a"][0] | "," | arrays["a"][1]) fmt.Println("ptr = " | ptrs["a"].x | "," | ptrs["a"].y) }