package main
import (
"fmt"
)
type S struct {
a, b, c string
}
func main() {
x := interface{}(&S{"a", "b", "c"})
y := interface{}(&S{"a", "b", "c"})
//x := &S{"a", "b", "c"}
//y := &S{"a", "b", "c"}
fmt.Println(x == y)
}
![image.png](https://static.studygolang.com/180719/474a144be547a6a4b876985fd532c4b1.png)
#1
更多评论
如上图,你的这个例子type是&S,但data是两个指针内容不一致。可以看看下面链接的内容。
https://research.swtch.com/interfaces
#2