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
550
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
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.2k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
850
The Curse of the Amulet
leimatthew05
1
13k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
150
The Mindset for Success: Future Career Progression
greggifford
PRO
0
360
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
210
How to make the Groovebox
asonas
2
2.2k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
430
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.1k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4k
Done Done
chrislema
186
16k
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