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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Tomoki Ota
August 15, 2024
Programming
0
49
【Go言語】値の比較
値の比較について解説しています
Tomoki Ota
August 15, 2024
Tweet
Share
More Decks by Tomoki Ota
See All by Tomoki Ota
アーキテクチャの価値
tomo1227
0
110
アーキテクチャとビジネスロジック
tomo1227
0
110
【Go言語】テスト
tomo1227
0
69
【Go言語】クロージャ
tomo1227
0
290
【Go言語】イテレータ
tomo1227
0
89
【Go言語】エラーハンドリング
tomo1227
0
73
AIに淘汰されないようにするには?
tomo1227
0
74
【Go言語】range
tomo1227
0
82
【Go言語】break
tomo1227
0
75
Other Decks in Programming
See All in Programming
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
0
210
AI 駆動開発ライフサイクル(AI-DLC):ソフトウェアエンジニアリングの再構築 / AI-DLC Introduction
kanamasa
11
6.3k
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
190
なるべく楽してバックエンドに型をつけたい!(楽とは言ってない)
hibiki_cube
0
140
Rust 製のコードエディタ “Zed” を使ってみた
nearme_tech
PRO
0
110
humanlayerのブログから学ぶ、良いCLAUDE.mdの書き方
tsukamoto1783
0
170
Vibe codingでおすすめの言語と開発手法
uyuki234
0
210
Fragmented Architectures
denyspoltorak
0
140
Grafana:建立系統全知視角的捷徑
blueswen
0
320
AgentCoreとHuman in the Loop
har1101
5
210
AIフル活用時代だからこそ学んでおきたい働き方の心得
shinoyu
0
120
そのAIレビュー、レビューしてますか? / Are you reviewing those AI reviews?
rkaga
6
4.4k
Featured
See All Featured
What does AI have to do with Human Rights?
axbom
PRO
0
2k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
170
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
88
AI Search: Where Are We & What Can We Do About It?
aleyda
0
6.9k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
50
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
200
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.5k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
630
エンジニアに許された特別な時間の終わり
watany
106
230k
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