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 1.26で変わるgo fix
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
hond
February 17, 2026
520
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Go 1.26で変わるgo fix
hond
February 17, 2026
More Decks by hond
See All by hond
Go言語の特性を活かした公式MCP SDKの設計
hond0413
2
1.3k
Featured
See All Featured
Believing is Seeing
oripsolob
1
140
Producing Creativity
orderedlist
PRO
348
40k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.1k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
160
The Language of Interfaces
destraynor
162
27k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
190
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
240
For a Future-Friendly Web
brad_frost
183
10k
Done Done
chrislema
186
16k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
The Cult of Friendly URLs
andyhume
79
6.9k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Transcript
Go 1.26で変わるgo fix golang.tokyo #43 hond
自己紹介 名前 • hond( ほんでぃー ) 趣味 • コーヒー、観葉植物、 Manchester
City 近況 • Go Conference mini in Sendai 2026 落ちました 👐
go fix使ってますか🙋
Fortunately, the go fix tool can automate much of the
work needed to bring programs up to the Go 1 standard. https://go.dev/doc/go1 Go 1に移行する際の破壊的変更を修正する便利ツール 37件のルールと Release Note でも14個所で言及される圧倒的存在感! 誕生当時のgo fix
• buildtag • cftype • context • egl • eglconf
• gotypes • jni • netipv6zone • printerconfig go 1.26以前のgo fix Goの言語仕様上活躍の機会が減少 1.25.7 ではルールは 9件に減少
go fixに関するproposal
proposal #73605 cmd/fix: remove all functionality #73605 go fix独自のルールは十分役目を終えたので全て削除 go
vet 同様に解析フレームワークを呼び出すように修正
cmd/go: fix: apply fixes from modernizers, inline, and other analyzers
#71859 modernize の導入 inline の導入 go vet 同様のanalyzer の採用 proposal #71859
https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/modernize 最新の構文や標準ライブラリの機能を利用しモダン化するための analyzer inteface{} をanyに修正など 24個のanalyzer が含まれる 1.26ではerrorsastype,newexpr が追加された ※一部偽陽性あり
modernizeとは
デフォルトで有効化されている modernizer を全て適用 $ go run golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest -fix ./… 個別modernizer
有効・無効化 $ modernize -any=true -fix ./... $ modernize -any=false -fix ./... modernizeとは
inlineとは https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/inline //go:fix inlineディレクティブが指定された関数や定数をインライン展開 ioutil package などで利用されている 実行方法 $ go
run golang.org/x/tools/go/analysis/passes/inline/cmd/inline@latest -fix ./...
inlineとは func main() { OldFunction() NewFunction() } //go:fix inline func
OldFunction() { NewFunction() } func NewFunction() { fmt.Println("NewFunction") } import "fmt" func main() { - OldFunction() + NewFunction() NewFunction() }
1.26以降のgo fixの使い方
go 1.26 go fix modernize やinline の実行 $ go fix
./… diff flag で差分の確認 $ go fix -diff ./… flagで個別analyzer の有効・無効を指定 $ go fix -fmtappendf=false -waitgroup=false ./…
modernize で破壊的変更を修正するツールからモダン化へ inline で非推奨や廃止されたコードの置換 AIが出力する古いコードの修正に一役買えそう まとめ
おまけ GopherCon 2025: Analysis and Transformation Tools for Go Codebase
Modernization - Alan Donovan https://www.youtube.com/watch?v=_VePjjjV9JU
None
The “self-service” paradigm https://go.dev/blog/gofix#the-self-service-paradigm annotation-driven source-level inliner 動的な解析ルールの読み込み 制御フローチェックの一般化
The “self-service” paradigm https://go.dev/blog/gofix#the-self-service-paradigm annotation-driven source-level inliner -> 前述したinline 動的な解析ルールの読み込み
-> package と一緒に独自の modernizer を提供しgopls やgo fixが動的に読み込み実 行 制御フローチェックの一般化 -> 「ファイルを開いたら閉じる」「コンテキストを作成したらキャンセルする」のようなフ ローを一般化し・統合
参考 issues https://github.com/golang/go/issues/71859 https://github.com/golang/go/issues/73605 https://github.com/golang/go/issues/75266 https://github.com/golang/go/issues/75267 https://github.com/golang/go/issues/59869 テックブログ https://tech.every.tv/entry/2025/12/22/150323