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
570
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.4k
Featured
See All Featured
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.1k
How Software Deployment tools have changed in the past 20 years
geshan
0
34k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
63
55k
From π to Pie charts
rasagy
0
230
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
Mobile First: as difficult as doing things right
swwweet
225
10k
Being A Developer After 40
akosma
91
590k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
260
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
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