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
July 25, 2024
Programming
0
130
【Go言語】オプション設定のベストプラクティス
Go言語のオプション設定方法について、解説しています。
【Qiita】
【Go言語】オプション設定のベストプラクティス
Tomoki Ota
July 25, 2024
Tweet
Share
More Decks by Tomoki Ota
See All by Tomoki Ota
アーキテクチャの価値
tomo1227
0
47
アーキテクチャとビジネスロジック
tomo1227
0
49
【Go言語】テスト
tomo1227
0
29
【Go言語】クロージャ
tomo1227
0
210
【Go言語】イテレータ
tomo1227
0
35
【Go言語】エラーハンドリング
tomo1227
0
37
AIに淘汰されないようにするには?
tomo1227
0
33
【Go言語】range
tomo1227
0
26
【Go言語】break
tomo1227
0
37
Other Decks in Programming
See All in Programming
iOSでQRコード生成奮闘記
ktcryomm
2
180
フロントエンドオブザーバビリティ on Google Cloud
yunosukey
0
140
やっと腹落ち「スプリント毎に動くモノをリリースする」〜ゼロから始めるメガバンクグループのアジャイル実践〜
sasakendayo
0
300
バイセルでの AI を用いた開発の取り組み ~ Devin, Cursor の活用事例・知見共有 ~
umaidashi
0
150
Your Architecture as a Crime Scene:Forensic Analysis @bastacon 2025 in Frankfurt
manfredsteyer
PRO
0
160
Google Cloudとo11yで実現するアプリケーション開発者主体のDB改善
nnaka2992
1
200
はじめての Go * WASM * OCR
sgash708
1
150
ABEMA iOS 大規模プロジェクトにおける段階的な技術刷新 / ABEMA iOS Technology Upgrade
akkyie
1
280
Return of the Full-Stack Developer
simas
PRO
1
180
Introduction to C Extensions
sylph01
3
150
Compose Navigation実装の見通しを良くする
hiroaki404
0
100
「個人開発マネタイズ大全」が教えてくれたこと
bani24884
1
330
Featured
See All Featured
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
176
52k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2.1k
VelocityConf: Rendering Performance Case Studies
addyosmani
328
24k
Optimizing for Happiness
mojombo
377
70k
Gamification - CAS2011
davidbonilla
80
5.2k
Rebuilding a faster, lazier Slack
samanthasiow
80
8.9k
What's in a price? How to price your products and services
michaelherold
244
12k
Building Flexible Design Systems
yeseniaperezcruz
328
38k
Done Done
chrislema
182
16k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
Designing for Performance
lara
605
69k
Into the Great Unknown - MozCon
thekraken
35
1.7k
Transcript
Tomoki Ota ʲGoݴޠʳΦϓγϣϯઃఆͷϕετϓϥΫςΟε
HTTPαʔόͷ࡞ 2
HTTPαʔόͷ࡞ 3
GinͷNew() 4
ᶃγϯϓϧͳΦϓγϣϯઃఆ ᶄCon f igߏମ ᶅBuilderύλʔϯ ᶆؔΦϓγϣϯύλʔϯ ᶇDysfunctional Options Pattern ᶈ݁
ΞδΣϯμ
γϯϓϧͳΦϓγϣϯઃఆํ๏
7 γϯϓϧͳઃఆํ๏
γϯϓϧͳઃఆํ๏ debugͷઃఆΛՃ͢Δ
HTTPαʔόͷ࡞ 9 ΫϥΠΞϯτଆͰҾ͕Γͳͯ͘յΕΔ
γϯϓϧͳઃఆํ๏
Con f igߏମ
Con f igߏମ
Con f igߏମ 13
Con f igߏମ 14
Con f igߏମ 15
ࢦఆ͠ͳ͔ͬͨύϥϝʔλʹθϩ͕ೖΔ(ҙ ਤతʹ0Λೖͨ͠ͷ͔ɺະೖྗͳͷ͔ͷҧ͍͕ ͔Βͳ͍) Con f igߏମͷσϝϦοτ
ࢦఆ͠ͳ͔ͬͨύϥϝʔλʹθϩ͕ೖΔ(ҙ ਤతʹ0Λೖͨ͠ͷ͔ɺະೖྗͳͷ͔ͷҧ͍͕ ͔Βͳ͍) Con f igߏମͷσϝϦοτ ϙΠϯλΛ͏
Con f igߏମͷσϝϦοτ ϙΠϯλΛ͏
Con f igߏମͷσϝϦοτ σϑΥϧτΛ͏߹ۭΛ͢ඞཁ͕͋Δ
Builderύλʔϯ
Builderύλʔϯͱʁ GoFͷσβΠϯύλʔϯͷ̍ͭ ॊೈੑͷߴ͍ղܾࡦΛఏڙ͠ɺՄಡੑΛߴΊΔ
Builderύλʔϯ 22
Builderύλʔϯ 23
Builderύλʔϯ 24
Builderύλʔϯ GOʹJavaͷ@BuilderΑ͏ͳຐ๏ͳ͍ GoFͷσβΠϯύλʔϯͷ̍ͭͰ͋ΔBuilderύλʔϯ Λ༻͍Δ͜ͱͰɺॊೈੑͷߴ͍ղܾࡦΛఏڙ͞ΕΔɻ Builderύλʔϯͷॻ͖ํෳ͋Δɻ
Builderύλʔϯ 26
Builderύλʔϯ
BuilderύλʔϯͷσϝϦοτ Con f igߏମಉ༷ɺσϑΥϧτͷઃఆΛ༻͍ͨ͠߹ ۭͷߏମΛ͢ඞཁ͕͋Γɺݟӫ͕͑ѱ͍
ؔΦϓγϣϯύλʔϯ
Functional Optional Pattern ؔΦϓγϣϯύλʔϯՄมݸҾʹґଘ ͢Δ ؔΦϓγϣϯύλʔϯͱʁ
ؔΦϓγϣϯύλʔϯͱʁ
ؔΦϓγϣϯύλʔϯͱʁ
ؔΦϓγϣϯύλʔϯͱʁ σϑΥϧτΛઃఆ͍ͨ͠߹ઃఆ͢Δඞཁ͕ͳ͍
Dysfunctional Options Pattern
ؔΦϓγϣϯύλʔϯத͕ؒଟ͘ɺෳࡶͰ ͋Δͱ͍͏͜ͱΛࢹͨ͠ύλʔϯ Dysfunctional Options Patternͱʁ
Dysfunctional Options Pattern
BulderύλʔϯͷҰͭ Dysfunctional Options Patternͱʁ
Dysfunctional Options Patternͱʁ ނʹɺσϑΥϧτΛ༻͍ͨ͠߹ɺۭͷߏମΛ͢ඞཁ͕͋Γ·͢ɻ ނʹɺσϑΥϧτΛ༻͍ͨ͠߹ɺۭͷߏମΛ͞ͳ͚ΕͳΒͳ͍
݁
GoͰҰ൪׳༻తͰ·ΕΔͷɺؔΦϓγϣϯύλʔϯ Builderύλʔϯ࣮͍͕͢͠ɺσϑΥϧτΛઃఆ͢Δ ͱ͖ʹɺJavaͱҧͬͯบ͕͋Δ ݁
GoͰҰ൪׳༻తͰ·ΕΔͷɺؔΦϓγϣϯύλʔϯɻ Builderύλʔϯ࣮͍͚͢͠ͲɺJavaͱҧ͍ɺগ͠บ͕͋Γ· ͢ɻ ݁