Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Go 1.26で変わるgo fix

Avatar for hond hond
February 17, 2026
160

Go 1.26で変わるgo fix

Avatar for hond

hond

February 17, 2026
Tweet

Transcript

  1. 自己紹介 名前 • hond( ほんでぃー ) 趣味 • コーヒー、観葉植物、 Manchester

    City 近況 • Go Conference mini in Sendai 2026 落ちました 👐
  2. 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
  3. • buildtag • cftype • context • egl • eglconf

    • gotypes • jni • netipv6zone • printerconfig go 1.26以前のgo fix Goの言語仕様上活躍の機会が減少 1.25.7 ではルールは 9件に減少
  4. cmd/go: fix: apply fixes from modernizers, inline, and other analyzers

    #71859 modernize の導入 inline の導入 go vet 同様のanalyzer の採用 proposal #71859
  5. inlineとは func main() { OldFunction() NewFunction() } //go:fix inline func

    OldFunction() { NewFunction() } func NewFunction() { fmt.Println("NewFunction") } import "fmt" func main() { - OldFunction() + NewFunction() NewFunction() }
  6. go 1.26 go fix modernize やinline の実行 $ go fix

    ./… diff flag で差分の確認 $ go fix -diff ./… flagで個別analyzer の有効・無効を指定 $ go fix -fmtappendf=false -waitgroup=false ./…
  7. おまけ GopherCon 2025: Analysis and Transformation Tools for Go Codebase

    Modernization - Alan Donovan https://www.youtube.com/watch?v=_VePjjjV9JU
  8. The “self-service” paradigm https://go.dev/blog/gofix#the-self-service-paradigm annotation-driven source-level inliner -> 前述したinline 動的な解析ルールの読み込み

    -> package と一緒に独自の modernizer を提供しgopls やgo fixが動的に読み込み実 行 制御フローチェックの一般化 -> 「ファイルを開いたら閉じる」「コンテキストを作成したらキャンセルする」のようなフ ローを一般化し・統合