「Go」Struct
匿名struct比较
1func main() { 2 sn1 := struct { 3 age int 4 name string 5 }{age: 11, name: "qq"} 6 7 sn2 := struct { 8 age int 9 name string 10 }{age: 11, name: "qq"} 11 12 if sn1 == sn2 { 13 fmt.Println("sn1 == sn2",sn1) 14 } 15 16 fmt.Printf("sn1 addr %p\n",&sn1) 17 fmt.Printf("sn2 addr %p\n",&sn2) 18} 1sn1 == sn2 {11 qq} 2sn1 addr 0xc0000a6020 3sn2 addr 0xc0000a6040