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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
29
actions/setup-go 完全に理解した
otakakot
1
56
Vendoring をやめたけどやめたのは正解だったのか
otakakot
0
69
t *testing.T は どこからやってくるの?
otakakot
1
1.2k
PostgreSQL を使った快適な go test 環境を求めて
otakakot
0
1.5k
組込みだけじゃない!TinyGo で始める無料クラウド開発入門
otakakot
2
660
組込みだけじゃない! TinyGo で始める無料クラウド開発入門
otakakot
1
180
統一感のある Go コードを生成 AI の力で手にいれる
otakakot
1
3.9k
SQLBoiler がメンテナンスモードになりまして
otakakot
0
410
Other Decks in Programming
See All in Programming
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.7k
モバイル交通系ICへのチャージ実例から考える、クロスプラットフォーム開発におけるiOS実機テスト設計とCI運用
yusuga
1
570
setup-vp GitLab対応の裏側
naokihaba
0
140
Vue Fes Japan 2026 タイムテーブル徹底解説
448jp
1
580
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
380
Agents on Rails - Rails at Scale 2026
irinanazarova
0
310
Embedded Swiftで作る自作USBデバイス によるiOSデバイスの自動テスト / iOSDC Japan 2026 glassfiber
glassfiber
0
250
Are APIs Still Relevant in the AI Era?
soyuka
0
390
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
370
設計次第でAIコードの読む量は減らせる / designing-for-code-reading
minodriven
32
14k
技術的負債の返済は、AI時代の複利で効く投資 — 経営としての意思決定とその遂行
curekoshimizu
1
2k
Security issues being discussed on Web Platforms
petamoriken
0
1.4k
Featured
See All Featured
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
380
AI: The stuff that nobody shows you
jnunemaker
PRO
10
1.1k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
390
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.2k
Done Done
chrislema
187
17k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
550
Embracing the Ebb and Flow
colly
88
5.2k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.6k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
How to Talk to Developers About Accessibility
jct
2
560
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
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
おわり またどこかで お会いしましょう!