#### 本人新手,刚学习go几天,遇到一个问题一直想不明白。请牛人解答,非常感谢!先直接看代码 ``` type HashSet struct { Element map[interface{}]bool sync.RWMutex } func (set *HashSet)Destroy(self *HashSet) { self = nil } // s1 类型是*HashSet,值是 {1:ture, "name":ture, 3.23:true} s1.Destroy(s1) // {1:ture, "name":ture, 3.23:true}, false fmt.Printf("%v, %v", s1, nil == s1) ``` #### **问题** 1. 请问这里为什么s1不是nil? 2. s1为什么还能打印出原来的值? 3. 尝试在Destroy修改值,比如self.Element["test"]=true,会发现s1也被修改了,这里是引用类型,并不是值传递,为什么可以修改s1的值,但是不能将s1=nil? 4. 打印反射的情况如下,怀疑跟interface一样,值为nil,而type不为nil,所以s1不为nil,于是尝试修改reflect.Type,直接编译报错了。 ``` // * HashSet // fmt.Printf("type => %v\n", reflect.TypeOf(self)) // // nil // fmt.Printf("value => %v\n", reflect.ValueOf(self)) ```