Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
【Go言語】値の比較
Search
Tomoki Ota
August 15, 2024
Programming
0
38
【Go言語】値の比較
値の比較について解説しています
Tomoki Ota
August 15, 2024
Tweet
Share
More Decks by Tomoki Ota
See All by Tomoki Ota
アーキテクチャの価値
tomo1227
0
71
アーキテクチャとビジネスロジック
tomo1227
0
79
【Go言語】テスト
tomo1227
0
45
【Go言語】クロージャ
tomo1227
0
230
【Go言語】イテレータ
tomo1227
0
55
【Go言語】エラーハンドリング
tomo1227
0
51
AIに淘汰されないようにするには?
tomo1227
0
47
【Go言語】range
tomo1227
0
46
【Go言語】break
tomo1227
0
53
Other Decks in Programming
See All in Programming
The Modern View Layer Rails Deserves: A Vision For 2025 And Beyond @ RailsConf 2025, Philadelphia, PA
marcoroth
2
710
MDN Web Docs に日本語翻訳でコントリビュートしたくなる
ohmori_yusuke
1
130
明示と暗黙 ー PHPとGoの インターフェイスの違いを知る
shimabox
2
610
RailsGirls IZUMO スポンサーLT
16bitidol
0
200
Startups on Rails in Past, Present and Future–Irina Nazarova, RailsConf 2025
irinanazarova
0
220
#QiitaBash MCPのセキュリティ
ryosukedtomita
1
1.5k
Goで作る、開発・CI環境
sin392
0
260
NPOでのDevinの活用
codeforeveryone
0
890
#kanrk08 / 公開版 PicoRubyとマイコンでの自作トレーニング計測装置を用いたワークアウトの理想と現実
bash0c7
1
930
Quand Symfony, ApiPlatform, OpenAI et LangChain s'allient pour exploiter vos PDF : de la théorie à la production…
ahmedbhs123
0
210
AI時代のソフトウェア開発を考える(2025/07版) / Agentic Software Engineering Findy 2025-07 Edition
twada
PRO
99
36k
Claude Code + Container Use と Cursor で作る ローカル並列開発環境のススメ / ccc local dev
kaelaela
12
7k
Featured
See All Featured
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
8
340
Side Projects
sachag
455
42k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
22k
Testing 201, or: Great Expectations
jmmastey
43
7.6k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Building Applications with DynamoDB
mza
95
6.5k
Writing Fast Ruby
sferik
628
62k
A Modern Web Designer's Workflow
chriscoyier
695
190k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Transcript
Tomoki Ota ʲGoݴޠʳͷൺֱ
ͷൺֱৗʹ==Λͬͯ ൺֱͰ͖ΔΘ͚Ͱͳ͍
ൺֱͰ͖Δྫ ൺֱͰ͖ͳ͍ྫ ൺֱՄೳͳΦϖϥϯυ ൺֱෆՄೳͳܕͷൺֱ ΞδΣϯμ 3
ൺֱͰ͖Δྫ
ൺֱͰ͖Δྫ 5
ൺֱͰ͖ͳ͍ྫ
ൺֱͰ͖ͳ͍ྫ 7
ൺֱՄೳͳΦϖϥϯυ
ൺֱՄೳͳΦϖϥϯυ 9 == ͱ !=ɺΦϖϥϯυ͕ൺֱՄೳ(comparable)ͷͱ͖ʹ༻Ͱ͖Δ
ൺֱՄೳͳΦϖϥϯυ 10 boolean (ܕɺුಈখܕɺෳૉܕ) จࣈྻ νϟωϧ ΠϯλʔϑΣΠε ϙΠϯλ ߏମͱྻ
ൺֱՄೳͳΦϖϥϯυ 11
ൺֱՄೳͳΦϖϥϯυ 12 structಉ༷ɺanyܕҙʂ
ൺֱෆՄೳͳܕͷൺֱ
ൺֱෆՄೳͳܕͷൺֱ 14 ඪ४ϥΠϒϥϦͷre f lectΛ༻͢Δ
ൺֱෆՄೳͳܕͷൺֱ 15 re f lect.DeepEqualؔ2ͭͷΛ࠶ؼతʹḷͬͯɺ2ͭͷཁૉ͕͍͠ ͔൱͔Λஅ͢Δɻ ͜ΕجຊσʔλܕɺྻɺߏମɺεϥΠεɺϚοϓɺϙΠϯλɺΠϯλʔ ϑΣΠεɺؔʹ༻Ͱ͖Δɻ
re f lect.DeepEqualͷྫ 16
re f lect.DeepEqualͷҙ 17 nilίϨΫγϣϯͱۭίϨΫγϣϯΛ۠ผ͢Δ(ϢʔεέʔεʹΑͬͯͱͳΔɻ ྫ͑2ͭͷΞϯϚʔγϟϧૢ࡞ͷ݁ՌΛൺֱ͍ͨ࣌͠) ϦϑϨΫγϣϯΛ͍ͬͯΔͷͰɺੑೳ্ͷϖφϧςΟ͕͋Δ ϕϯνϚʔΫͰɺ==ͷ100ഒ͍ύϑΥʔϚϯεɻຊ൪Ͱͬͯμϝ
ಠࣗͷൺֱϝιουΛ࣮͢Δ 18 ಠࣗͷൺֱϝιουΛ༻͢Δͱɺ ύϑΥʔϚϯε͕վળ͢Δɻ ࠨͷίʔυre f lect.DeepEqualͷ96ഒߴ
ϢχοτςετͰͷൺֱ 19 ϢχοτςετͰɺgo-cmptestifyͱ͍ͬͨ֎෦ϥΠϒϥϦΛ༻Ͱ͖Δɻ ͔͠͠ɺ࣮ߦ࣌ͷੑೳ͕ॏཁͳ߹ɺಠࣗͷؔΛ࣮͢Δ͜ͱ͕ϕετϓϥΫςΟεɻ
ͦͷ΄͔ͷൺֱؔ 20 ඪ४ϥΠϒϥϦʹɺbytes.Compareͱ͍͏2ͭͷbyteεϥΠεΛ ൺֱͰ͖ΔϥΠϒϥϦ͕ଘࡏ͢Δɻ ಠࣗͷؔΛ࣮͢Δલʹɺंྠͷ࠶ൃ໌Λ͍ͯ͠ͳ͍͜ͱΛ֬ೝ͢Δʂ
ൺֱՄೳͳΒ==, !=Λ͏ ύϑΥʔϚϯεΛؾʹ͠ͳ͍ͳΒre f lectionΛ༻͢Δ ύϑΥʔϚϯεΛؾʹ͢ΔͳΒಠ࣮ࣗ ಠ࣮ࣗ͢ΔલʹطଘͷϥΠϒϥϦ͕ଘࡏ͢Δ͔ௐΔ ·ͱΊ 21