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
Go で作った CLI ツールにバージョンを埋め込みたい
Search
Kotaro Otaka
November 19, 2025
Programming
260
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Go で作った CLI ツールにバージョンを埋め込みたい
The Go gopher was designed by Renée French.
https://gotalk.connpass.com/event/372360/
Kotaro Otaka
November 19, 2025
More Decks by Kotaro Otaka
See All by Kotaro Otaka
Go で「見つからなかった」をどう表現するか
otakakot
0
34
actions/setup-go 完全に理解した
otakakot
1
130
Vendoring をやめたけどやめたのは正解だったのか
otakakot
0
70
t *testing.T は どこからやってくるの?
otakakot
1
1.2k
PostgreSQL を使った快適な go test 環境を求めて
otakakot
0
1.5k
組込みだけじゃない!TinyGo で始める無料クラウド開発入門
otakakot
2
670
組込みだけじゃない! TinyGo で始める無料クラウド開発入門
otakakot
1
180
統一感のある Go コードを生成 AI の力で手にいれる
otakakot
1
3.9k
SQLBoiler がメンテナンスモードになりまして
otakakot
0
450
Other Decks in Programming
See All in Programming
AI-Powered Domain-Driven Design
ziobrando
0
200
Event is what happens
moro
2
1.2k
Next.js: The final boss of Web Performance
guaca
0
310
なぜCTOを降りてFDEを選んだのか?〜なぜプロダクト企業がFDEで顧客の現場に踏み込むのか〜
gonta
1
230
npm との違いを手がかりにGo の依存管理を理解したい
optim
0
1k
AmebaブログはKMPから卒業します
kmars0605
0
210
パスワード再設定メールのURLについて知っておこう
uyuki234
0
170
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
510
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
290
PyConTW 2026 - AI Coding 不只是工具升級, 區域醫院醫療資訊系統協作開發與資訊團隊轉型實踐
cclai999
0
140
全ての永続トークンを、生まれる前に消し去りたい!
sylph01
2
1.1k
PumaからFalconに移行したRailsアプリケーションでの実践
falcon8823
0
190
Featured
See All Featured
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.6k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
BBQ
matthewcrist
90
10k
Scaling GitHub
holman
464
140k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
720
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
3.5k
Side Projects
sachag
456
43k
Building a Scalable Design System with Sketch
lauravandoore
464
34k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
430
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
330
Transcript
The Go gopher was designed by Renée French. Go で作った
CLI ツールに バージョンを埋め込みたい おーたかこーたろー / @otakakot 2025.11.19 Go Connect #10
#goconnect Go で CLI ツールを作成したことある人
#goconnect バージョン出力したいな
#goconnect バージョンはどうやって管理する?
バージョン管理手法を4パターン紹介! #goconnect
紹介するパターンは OSS の実装を参照 #goconnect
Kotaro Otaka おーたかこーたろー / @otakakot #goconnect Web Engineer 新卒入社 Hello
Golang! Web Engineer @株式会社ビットキー 2020.04 2021.04 2022.11 Gopher 年生 Go
#goconnect 定数/const パターン
定数でバージョンを管理 #goconnect Features
#goconnect
もっともシンプル #goconnect Pros
自動更新を考えるとめんどくさい #goconnect Cons
#goconnect beego フレームワークのための CLI ツール
#goconnect go:embed パターン
Go 1.16 で追加された 外部ファイルをプログラム に埋め込む機能を利用 #goconnect Features
#goconnect
定数で扱うより自動更新は楽 #goconnect Pros
バージョン更新のために コミットしないといけない #goconnect Cons
#goconnect XMLとHTMLの操作 CLI ツール
#goconnect go build -ldflags パターン
ビルド時に -ldflags オプションを利用し バージョン情報を外部から渡す #goconnect Features
#goconnect
コード外でバージョン情報を管理可能 #goconnect Pros
go install だとバージョンが含まれない #goconnect Cons
#goconnect k8s ファイルを分割するための CLI ツール
#goconnect buildinfo パターン
Go 1.18 で追加された Git の commit id や commit した時刻等の
バージョン管理システム(VCS) 情報を利用 #goconnect Features
#goconnect
go install でもバージョン情報が含まれる #goconnect Pros
実装が多少複雑化 #goconnect Cons
#goconnect kubectl の出力を色付けする CLI ツール
#goconnect まとめ
パターン名 バージョン管理場所 定数/const Go コード go:embed テキストファイル go build -ldflags
git tag など + ビルド時注入 buildinfo バージョン管理システム(VCS) #goconnect
#goconnect おすすめは buildinfo
おわり またどこかで お会いしましょう!