You can simply write in multi-line form like this,
$ cat dict.go package main import "fmt" func main() { items := map[string]interface{}{ "foo": map[string]int{ "strength": 10, "age": 2000, }, "bar": map[string]int{ "strength": 20, "age": 1000, }, } for key, value := range items { fmt.Println("[", key, "] has items:") for k,v := range value.(map[string]int) { fmt.Println("\t-->", k, ":", v) } } }
And the conclusion:
$ go run dict.go [ foo ] has items: --> strength : 10 --> age : 2000 [ bar ] has items: --> strength : 20 --> age : 1000
han solo May 20 '19 at 12:14 2019-05-20 12:14
source share