type Interface interface {DoSomething()}type S struct {a []intb float64}func NewS(length int, alpha float64) S {return S{ make([]int, length), alpha }}func (s S) DoSomething() {}func main() {s1 := NewS(10, 1.0)s2 := s1 // Here we create a new copy of Svar i1 Interface
i1 = s1
i2 := i1
}
type interface struct {typ *type
data uintptr
}
In fact, an interface is something like:type interface struct {typ *typedata uintptr}So we should not test the address of i1 and i2. Instead we need to check if i1.data, i2.data, &s1, &s2 are the same or not. But I am not very sure how to get i1.data and i2.data.