Guest User

Untitled

a guest
Mar 23rd, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. fmt.Println(bar)
  2.  
  3. p1 := Person{
  4. Name: "太郎",
  5. Age: 20,
  6. }
  7.  
  8. p2 := Person{
  9. Name: "太郎",
  10. Age: 20,
  11. }
  12.  
  13. fmt.Println("単純な構造体の比較")
  14. fmt.Printf("p1 == p2 : 等価(メモリが別でも値が一緒だったらOK) : %t\n", p1 == p2)
  15. fmt.Printf("&p1 == &p2 : 等値 : %t\n", &p1 == &p2)
  16. fmt.Printf("reflect.DeepEqual(p1, p2) : 等価 : %t\n", reflect.DeepEqual(p1, p2))
  17. fmt.Printf("reflect.DeepEqual(&p1, &p2) : %t\n", reflect.DeepEqual(&p1, &p2))
  18.  
  19. fmt.Println(bar)
  20. fmt.Println("単純な構造体の比較2")
  21. p3 := p1
  22. fmt.Printf("p1 == p3 : 等価(メモリが別でも値が一緒だったらOK) : %t\n", p1 == p3)
  23. fmt.Printf("&p1 == &p3 : 等値 : %t\n", &p1 == &p3)
  24. fmt.Printf("reflect.DeepEqual(p1, p3) : 等価 : %t\n", reflect.DeepEqual(p1, p3))
  25. fmt.Printf("reflect.DeepEqual(&p1, &p3) : %t\n", reflect.DeepEqual(&p1, &p3))
Add Comment
Please, Sign In to add comment