m := make(map[string][]string)
m["like"] = []string{"a", "b"}
v := m["like"]
fmt.Println(m["like"])
v = append(v, "c")
fmt.Println(v)
fmt.Println(m["like"])
上述代码输出
[a b]
[a b c]
[a b]
我理解不了为什么没有修改键的值
m := make(map[string][]string)
m["like"] = []string{"a", "b"}
v := m["like"]
fmt.Println(m["like"])
v = append(v, "c")
fmt.Println(v)
fmt.Println(m["like"])
上述代码输出
[a b]
[a b c]
[a b]
我理解不了为什么没有修改键的值