jjzjj

peerCount

全部标签

go - 双花括号在结构声明中是什么意思?

谁能解释一下这段代码中的双花括号{{是什么意思?:func(t*testService)APIs()[]rpc.API{return[]rpc.API{{Namespace:"test",Version:"1.0",Service:&TestAPI{state:&t.state,peerCount:&t.peerCount,},}}}AFIK单个花括号足以创建一个结构,那么为什么要加倍呢?API结构定义如下:packagerpc//APIdescribesthesetofmethodsofferedovertheRPCinterfacetypeAPIstruct{Namespacest