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
220
Kubernetesを使わない環境にもCloud Nativeなデプロイを実現する / Enabling Cloud Native deployments without the complexity of Kubernetes
linyows
3
920
Protocol Buffersの型を超えて拡張性を得る / Beyond Protocol Buffers Types Achieving Extensibility
linyows
0
320
研究開発と実装OSSと プロダクトの好循環 / A virtuous cycle of research and development implementation OSS and products
linyows
1
1k
コードジェネレーターで 効率的な開発をする / Efficient development with code generators
linyows
0
520
研究を支える拡張性の高い ワークフローツールの提案 / Proposal of highly expandable workflow tools to support research
linyows
0
750
非コンテナ環境において宣言的Deploymentを手軽に実現する / Declarative deployment in non-container environments
linyows
1
670
メール送信サーバの集約における透過型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
740
Other Decks in Technology
See All in Technology
遠藤な_めぐろLT #38 「社内のAI活用推進」@麻布台_20261009
endonanana
0
130
V8のArray.prototype.flatを最大約20倍速くするまでと、巨大OSSへの大規模コミットの道のり
riyaamemiya
0
290
継続的なAIコスト最適化
bgpat
1
340
Getting Started with Google Antigravity
glaforge
0
300
Running Kotlin + Quarkus with Lambda
nealle
1
3.7k
分析AIエージェントを育てる、動く環境を育てる
codatum
1
1.1k
Metadata - Section 1: HTML Basics
mohab1
0
120
DevelopersIO 2026 知識の地図を描く ─ オントロジーとは何か?
ishikawa_satoru
1
1.7k
LambdaWebFunctionsを試してみた / exploring-lambda-web-functions
koukihosaka
1
330
re:Invent初参加で変わったこと、2回目にやってみたいこと(JAWS-UG彩の国埼玉 #12)
mhrtech
2
220
Refining Active Record
shugo
0
150
スキマバイトという雇用形態は存在しないので、雇用期間1日のアルバイト契約を事業者とワーカーが結ぶ手続きを支えるのがタイミーなんです
akitoshiga
0
200
Featured
See All Featured
Faster Mobile Websites
deanohume
310
32k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.6k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
410
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.4k
WENDY [Excerpt]
tessaabrams
14
40k
Code Review Best Practice
trishagee
74
20k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
540
How to make the Groovebox
asonas
2
2.5k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
59k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
570
The Curse of the Amulet
leimatthew05
3
16k
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] []}
͋Γ͕ͱ͏͍͟͝·ͨ͠