这样写好?:
p := []interface{}{"abc", map[string]string{"key1":"val1","key2":"val2"}}
str, _ := p[1].(map[string]string)
fmt.Println(str["key1"]);
还是这样写?:
p := []interface{}{"abc", &map[string]string{"key1":"val1","key2":"val2"}}
str, _ := p[1].(*map[string]string)
fmt.Println((*str)["key1"]);
有疑问加站长微信联系(非本文作者)