求助:这样的结构该如何赋值

gy0624ww · · 780 次点击
t.Pid = make(map[string]*CPCPrice, 0) t.Pid["test"] = new(CPCPrice) t.Pid["test"].Price = priceA
#1
更多评论
func main() { dataA := make(map[string]*CPCPrice) priceA := make(map[string]uint32) priceA["sousuo"] = uint32(10) priceA["zhanshi"] = uint32(20) t := Test{Pid:dataA} t.Pid["test"] = &CPCPrice{ Price: priceA, } fmt.Println(t, dataA) }
#2