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
91
【Go言語】オプション設定のベストプラクティス
Go言語のオプション設定方法について、解説しています。
【Qiita】
【Go言語】オプション設定のベストプラクティス
Tomoki Ota
July 25, 2024
Tweet
Share
More Decks by Tomoki Ota
See All by Tomoki Ota
アーキテクチャの価値
tomo1227
0
41
アーキテクチャとビジネスロジック
tomo1227
0
45
【Go言語】テスト
tomo1227
0
23
【Go言語】クロージャ
tomo1227
0
210
【Go言語】イテレータ
tomo1227
0
31
【Go言語】エラーハンドリング
tomo1227
0
34
AIに淘汰されないようにするには?
tomo1227
0
31
【Go言語】range
tomo1227
0
22
【Go言語】break
tomo1227
0
34
Other Decks in Programming
See All in Programming
Domain-Driven Transformation
hschwentner
2
1.9k
CI改善もDatadogとともに
taumu
0
120
社内フレームワークとその依存性解決 / in-house framework and its dependency management
vvakame
1
560
Djangoアプリケーション 運用のリアル 〜問題発生から可視化、最適化への道〜 #pyconshizu
kashewnuts
1
250
動作確認やテストで漏れがちな観点3選
starfish719
6
1k
負債になりにくいCSSをデザイナとつくるには?
fsubal
10
2.5k
Writing documentation can be fun with plugin system
okuramasafumi
0
120
Honoとフロントエンドの 型安全性について
yodaka
7
1.3k
プログラミング言語学習のススメ / why-do-i-learn-programming-language
yashi8484
0
140
Kubernetes History Inspector(KHI)を触ってみた
bells17
0
230
ARA Ansible for the teams
kksat
0
150
一休.com のログイン体験を支える技術 〜Web Components x Vue.js 活用事例と最適化について〜
atsumim
0
560
Featured
See All Featured
Being A Developer After 40
akosma
89
590k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
21
2.5k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
10
1.3k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
49
2.3k
Statistics for Hackers
jakevdp
797
220k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
1k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
33
2.8k
Documentation Writing (for coders)
carmenintech
67
4.6k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
45
9.4k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2.1k
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ͱҧ͍ɺগ͠บ͕͋Γ· ͢ɻ ݁