通过指针获取值
问题描述:
How I can get a value by key through a pointer?
m := map[interface{}]interface{}{
"uid": "007",
"msg": "Hi James!",
}
fmt.Println(m["msg"]) //Ok!
p := &m
fmt.Println(p["msg"]) //??
play with: http://play.golang.org/p/4LOBrog93t
答
just through the value of the pointer:
fmt.Println((*p)["msg"])