Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Configuration language for Go is any good?
Search
linyows
September 16, 2014
Technology
1.9k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Configuration language for Go is any good?
TL;DR; HCLを使え
linyows
September 16, 2014
More Decks by linyows
See All by linyows
GoとClickhouseで作るRAGアプリ / Building RAG Application with Go and Clickhouse
linyows
1
120
Kubernetesを使わない環境にもCloud Nativeなデプロイを実現する / Enabling Cloud Native deployments without the complexity of Kubernetes
linyows
3
830
Protocol Buffersの型を超えて拡張性を得る / Beyond Protocol Buffers Types Achieving Extensibility
linyows
0
310
研究開発と実装OSSと プロダクトの好循環 / A virtuous cycle of research and development implementation OSS and products
linyows
1
990
コードジェネレーターで 効率的な開発をする / Efficient development with code generators
linyows
0
510
研究を支える拡張性の高い ワークフローツールの提案 / Proposal of highly expandable workflow tools to support research
linyows
0
730
非コンテナ環境において宣言的Deploymentを手軽に実現する / Declarative deployment in non-container environments
linyows
1
650
メール送信サーバの集約における透過型SMTP プロキシの定量評価 / Quantitative Evaluation of Transparent SMTP Proxy in Email Sending Server Aggregation
linyows
0
1.3k
透過型SMTPプロキシによる送信メールの可観測性向上: Update Edition / Improved observability of outgoing emails with transparent smtp proxy: Update edition
linyows
2
720
Other Decks in Technology
See All in Technology
アクセスキーこわい やめかたと漏らさない工夫
sassssan68
1
140
積み重なった技術負債への挑戦 〜初手としての全社ゴト化〜
techtekt
PRO
0
750
新機種発売前に見直そう!端末移行で再ログインが要るアプリ・要らないアプリは何が違うのか 〜シームレスに再開できる設計と実装〜
zozotech
PRO
0
170
Deploying a Full-Stack Bun-Native Framework on Cloudflare Workers
7nohe
0
160
家のリアーキテクト・リファクタリング
suguruooki
0
150
iOSDC Japan 2026 day1 TrackC 10:50
feedtailor
1
150
アプリログインとWeb認証基盤をつなぐ ASWebAuthenticationSession 作法
shimastripe
1
310
おい、エージェントを使って終わらせろ
nwiizo
0
200
データ界隈LT祭 第1回LT登壇
taromatsui_cccmkhd
1
1.3k
Sigmaユーザーのための有用リソース一挙公開 & Sigmaで使えるMCP #sigma_ucj /useful-resources-for-sigma-computing-users-and-mcps-with-sigma
shinyaa31
0
230
DEFCON_CHV_CTF_Write-up.pdf
bata_24
0
150
Minecraft JavaのMODをSwiftで作る
1mash0
0
160
Featured
See All Featured
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
480
What does AI have to do with Human Rights?
axbom
PRO
1
2.4k
Google's AI Overviews - The New Search
badams
0
1.6k
Product Roadmaps are Hard
iamctodd
55
13k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.7k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
520
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
We Are The Robots
honzajavorek
0
370
The agentic SEO stack - context over prompts
schlessera
0
940
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
280
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
Transcript
HCL/TOMLศར @linyows / Fukuoka.go
@linyows / Tomohisa Oda GMO pepabo, incٕज़ج൫νʔϜ SCRAPTURE
͓Βͤ དྷि༵ʹ 5SBWJT.FFUVQJOԬɹ͕͋Γ·͢ 5SBWJT$*ͷ)JSP"TBSJ͞Μ͕དྷʢདྷʣ͞ΕΔͷͰɺ͓Λ ͬͨΓ࣭ͨ͠Γ͢ΔձͰ͢ɻ-5ืूதͰ͢ʂʂʂ IUUQLJCBOEPPSLFFQFSKQFWFOUT
ઃఆϑΝΠϧͲ͏ͯ͠Δʁ JSON / YAML / GO…
JSON { "foo": { "bar": "hello", "baz": { "key": 7,
"hoge": true, "values": [0, 1, 2] } } } • なんか冗長すぎる • コメントが書けない • Structにtag書くの面倒 • 記述に迷う事はない
YAML foo: bar: hello baz: key: 7 hoge: off on:
'true' # comment~ values: [0, 1, 2] fuga: !str 123 "999": ~ • シンプルに書ける(コンパクト) • 色々な表現が出来る Anchor/Alias 型宣言 • 逆に敷居が高いのかも… キーにハイフンとか • でもまあ、yamlで良い気がするけど
͡Ό͋ GoͰ… func MyConfig() *Config { return &Config{ Bar: "hello",
Baz: BazConfig{ Key: 7, Hoge: true, Values: []int{1, 2, 3}, }, } } • ださい…し、Goの知識がない人はつらい
HCL !?
HCLͱ HashiCorp Configuration Languageͷུ Vagrant, Serf…ͱ͔ͷHashCorp JSONޓ… JSONYAMLΛผͳݴޠʹஔ͖͑ΔͷͰͳ͍ผͷϨΠϠʔ JSONΛϑϨϯυϦʔʹͨ͠ͷ
Grammar hclData := ` a = "Easy!" b { c
= 2 // comment~ d = [3, 4] e = true } ` variable "foo" { default = "bar" description = "bar" } variable "amis" { default = { east = "foo" } }
Decode type Config struct { A string B struct {
C int D []int E bool } } hclObject, _ := hcl.Parse(hclData) fmt.Println(hclObject) // &{ 7 [0x2081f0240 0x2081f0390 0x2081f0480 0x2081f0600 0x2081f0690] <nil>} fmt.Println(hclObject.Get("b", false).Get("e", false).Value) // true var c Config hcl.DecodeObject(&c, hclObject) fmt.Println(c) // {Easy! {2 [3 4] true} false}
TOML !?
TOMLͱ Tom's Obvious, Minimal Languageͷུ Github Cofounderͷ Tom Preston-Werner (@mojombo)
ϑϨϯυϦʔͳಡΈॻ͖ ύʔαΛॻ͘ͷ͕؆୯Β͍͠
Grammar hclData := ` A = "Easy!" ! [B] C
= 2 D = [3, 4] E = true ` title = "TOML Example" ! [owner] name = "Tom Preston-Werner" organization = "GitHub" bio = "GitHub Cofounder & CEO\nLikes tater tots and beer." dob = 1979-05-27T07:32:00Z # First class dates? Why not? ! [database] server = "192.168.1.1" ports = [ 8001, 8001, 8002 ] connection_max = 5000 enabled = true [servers] ! # comment [servers.alpha] ip = "10.0.0.1" dc = "eqdc10" ! [servers.beta] ip = "10.0.0.2" dc = "eqdc10"
Decode type Config struct { A string B struct {
C int D []int E bool } } var c Config meta, _ := toml.Decode(tomlData, &config) fmt.Println(config) // {Easy! {2 [3 4] true}} fmt.Println(meta) // {map[A:Easy! B:map[D:[3 4] E:true C:2]] map[A:String B:Hash B.C:Integer B.D:Array B.E:Bool] [[A] [B] [B C] [B D] [B E]] map[B.C:true B.D:true B.E:true A:true B:true] []}
͋Γ͕ͱ͏͍͟͝·ͨ͠