如何通过指针按键获取值?
m := map[interface{}]interface{}{
"uid": "007",
"msg": "Hi James!",
}
fmt.Println(m["msg"]) //Ok!
p := &m
fmt.Println(p["msg"]) //??
答案 0 :(得分:3)
只需通过指针的值:
fmt.Println((*p)["msg"])