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
hond
February 17, 2026
0
160
Go 1.26で変わるgo fix
hond
February 17, 2026
Tweet
Share
More Decks by hond
See All by hond
Go言語の特性を活かした公式MCP SDKの設計
hond0413
2
1.1k
Featured
See All Featured
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.2k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.6k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
450
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
500
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
1
140
The Spectacular Lies of Maps
axbom
PRO
1
560
New Earth Scene 8
popppiees
1
1.6k
A Tale of Four Properties
chriscoyier
162
24k
30 Presentation Tips
portentint
PRO
1
240
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.6k
Documentation Writing (for coders)
carmenintech
77
5.3k
Building the Perfect Custom Keyboard
takai
2
700
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