import "testing"
type S struct {
Name string
}
func (s *S) Write() {
s.Name = "123"
}
func TestX(t *testing.T) {
s := S{}
// 这里能编译通过
s.Write()
sVals := map[int]S{1: {"A"}}
// 这能编译通过:
s2 := sVals[1]
s2.Write()
// 这里不能编译通过
sVals[1].Write()
}
就是最后一个为什么不能编译通过。

