企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
* 相同struct类型的可以比较 * 不同struct类型的不可以比较,编译都不过,类型不匹配 ~~~go package main import "fmt" func main() { type A struct { a int } type B struct { a int } a := A{1} //b := A{1} b := B{1} if a == b { fmt.Println("a == b") }else{ fmt.Println("a != b") } } output: > command-line-arguments [command-line-arguments.test] > ./.go:14:7: invalid operation: a == b (mismatched types A and B) ~~~