变量键如何在不迭代的情况下找到地图值?, q. S: ?5 v# ]8 g
因此,可以使用 搜索变量映射 $x 上常量键$x.key但是可以这样做amap.$key吗?9 l0 a) d5 N7 ^2 `$ q
$ o d: z! `& [- W* Y 解决方案: ' o. b& k! L& v" I+ c- M. l, c% u9 S
您使用该index功能:: Z! z) B" g; |. ]) c6 [5 g
{{index .Amap "key1"}}index Returns the result of indexing its first argument by the following arguments. Thus "index x 1 2 3" is,in Go syntax, x[1][2][3]. Each indexed item must be a map,slice,or array. " w M5 S4 Q5 W6 D5 i4 E