在阅读了有关在地图中使用切片的相关问题后,我对 Go 中的平等感到好奇。
我知道可以覆盖equalsJava的方法Object。是否有类似的方法来定义 Go 如何检查用户定义的类型/结构是否相等?如果是这样,上面提到的问题将有一个解决方法。我认为使用interface{}值可能会提供解决方案,但我收到了错误消息panic: runtime error: hash of unhashable type []int。
equals
Object
interface{}
panic: runtime error: hash of unhashable type []int
手掌心
慕桂英546537
相关分类