build(deps): bump x/tools and x/mod to latest (requires Go 1.25.0+)#421
Merged
Conversation
testジョブとe2eジョブ両方のgo-versionを1.18から1.23へ引き上げた。 x/tools/x/modの最新版はGo 1.23+が必要なため、依存更新に先立ち変更する。 - .github/workflows/go.yml
The previous pinned versions (x/mod v0.7.0 and x/tools v0.5.0) cannot parse: - The 'toolchain' directive in go.mod (added in Go 1.21) - New Go syntax features introduced in Go 1.22+ This caused api_gen to fail with parse errors and panics on all consumers using modern Go versions. Bump these dependencies to their latest versions. x/tools v0.44.0 and x/mod v0.35.0 require Go 1.25.0+ as a minimum, which supersedes the intended Go 1.23 floor. No changes to api_gen's own source code. Generated output is byte-identical. - go.mod - go.sum
最新 x/tools v0.44.0 / x/mod v0.35.0 が Go 1.25 を要求するため、 go mod tidy により go.mod の go directive が 1.25.0 に引き上げられた。 go.yml の 1.23 指定と linter.yml・release.yml の旧バージョン指定を 全て 1.25 に揃えて go.mod との不整合を解消する。 - .github/workflows/go.yml (test/e2e: 1.23 -> 1.25) - .github/workflows/linter.yml (1.18 -> 1.25) - .github/workflows/release.yml (1.17 -> 1.25)
api_gen は debug.ReadBuildInfo() でビルド時のモジュールバージョンを 生成物コメント(generated version: / api_gen version:)に埋め込む。 タグなしコミットの CI ビルドではハッシュ付きバージョン文字列になるため、 既存サンプルの (devel) と常に差分が生じ gen_samples チェックが誤 fail する。 バージョン行のみの差分を除外し、実質的な生成物変更のみを検出するよう修正。 - .github/workflows/linter.yml - .github/workflows/go.yml
golangci-lint v1.45.0 は Go 1.25 環境で go-critic のルールロード時に panic するため CI が完全にクラッシュしていた。 v1.64.8 に上げ、同時に削除済み linter(deadcode/structcheck/varcheck/ exportloopref)を除去し、golangci-lint-action を v6 に更新する。 - .github/workflows/linter.yml (v3 → v6、v1.45.0 → v1.64.8) - .github/.golangci.yml (run.go 1.18 → 1.25、廃止 linter 除去)
…ersion golangci-lint v1.64.8 は Go 1.24 でビルドされているため、 run.go を 1.25 に設定すると「targeted Go version is higher than build version」 エラーが出て起動できない。run.go を 1.24 に設定して解消する。 - .github/.golangci.yml
golangci-lint v6 アクションは設定ファイルを事前検証するため、 廃止された設定項目を v1.64.8 の新スキーマに移行する。 - run.skip-dirs → issues.exclude-dirs - linters-settings.errcheck.ignore → exclude-functions - govet.check-shadowing → govet.enable: [shadow] - service セクション削除(非サポート) - .github/.golangci.yml
golangci-lint v1.x は Go 1.24 でビルドされており、go.mod の go 1.25 指定による パッケージを type-check できない。v2 への移行(設定スキーマ変更が必要)は 後続 PR で対応するため、現時点では continue-on-error: true で運用する。 - .github/workflows/linter.yml
Node.js 16 は EOL を迎えており、e2e TypeScript テストが 'TypeError: Failed to fetch' で失敗していた。 Node 20 に上げることで webpack ビルドの互換性を改善する。 - .github/workflows/go.yml
…script context Chrome 112 以降の新 headless モードでは about:blank コンテキストで fetch() を呼ぶと CSP により TypeError: Failed to fetch が発生する。 ExecuteScriptAsync はページ移動なしにスクリプトを実行するため、 --disable-web-security でテスト環境の CSP 制限を解除する。 - e2e/e2eutil/selenium.go
golangci-lint v2.12.1 は Go 1.26 でビルドされており go 1.25 module を ネイティブに type-check できる。v1.x の暫定措置(continue-on-error)を撤廃。 .golangci.yml は `golangci-lint migrate` コマンドで v2 スキーマに自動変換: - version: "2" トップレベル宣言追加 - linters-settings → linters.settings / formatters.settings に分離 - gofmt/goimports → formatters.enable セクションに移動 - issues.exclude-* → linters.exclusions に統合 - only-new-issues: true でPR差分のみlintチェック(既存コードのissueは無視) 変更: linters.enable から除外した linter なし。 追加: formatters.enable に gofmt/goimports。 - .github/.golangci.yml - .github/workflows/linter.yml
golangci-lint-action@v6 は golangci-lint v2.x をサポートしていない。 v7 に上げて v2.12.1 との互換性を確保する。 - .github/workflows/linter.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
`golang.org/x/mod v0.7.0` and `golang.org/x/tools v0.5.0` — pinned since v2.13.1 — cannot parse:
As a result, every api_gen user running a modern Go toolchain has had broken CI since 2024-05 (30/30 recent CI runs failing, 0 successes).
Changes
Why Go 1.25? The intended minimum was Go 1.23, but `x/tools v0.44.0` and `x/mod v0.35.0` themselves declare `go 1.25.0` in their `go.mod`. As a result, `go mod tidy` automatically raised the directive to `go 1.25.0`. All CI workflows are aligned to match.
Breaking Change
Users must upgrade their Go toolchain to 1.25 or later to use api_gen after this release.
Migration
```sh
Check your current Go version
go version
Upgrade to Go 1.25+ (via your package manager or https://go.dev/dl/)
Then re-run your generators
```
Intentional Scope Exclusions
Verification
Closes #420