Skip to content

Conversation

@hangingman
Copy link
Collaborator

このコミットでは、Go 1.24 のツール依存関係を go.mod で直接管理する機能を利用して、テスト実行とレポート機能を強化するためにプロジェクトに gotestsum を導入します。

主な変更点:

  • go get -d および go mod edit -tool を使用して、go.mod へのツール依存関係として gotest.tools/gotestsum を追加しました。
  • Makefile を更新しました:
  • test ターゲットで short-verbose 形式の gotestsum を使用するようになりました。
  • gotestsum --rerun-fails を使用して test-rerun-fails ターゲットを追加しました。
  • gotestsum --junitfile report.xml --format dots を使用して test-ci ターゲットを追加しました。
  • Makefile のテストターゲットで、実行に go run gotest.tools/gotestsum を使用するようになりました。
  • clean ターゲットを更新し、report.xml.gotestsum.json を削除しました。
  • GitHub Actions ワークフロー (.github/workflows/go.yml) を更新しました。
  • go install gotest.tools/gotestsum@v1.12.3 のステップを追加しました。
  • テスト実行を make test-ci に変更しました。
  • report.xml アーティファクトをアップロードするステップを追加しました。

このアプローチは、gotestsum を管理するための以前の tools.go メソッドに代わるものであり、新しい Go ツール標準に準拠しています。

This commit introduces `gotestsum` to the project for enhanced test
execution and reporting, utilizing the Go 1.24 feature for managing
tool dependencies directly in `go.mod`.

Key changes:
- Added `gotest.tools/gotestsum` as a tool dependency to `go.mod`
  using `go get -d` and `go mod edit -tool`.
- Updated Makefile:
  - The `test` target now uses `gotestsum` with `short-verbose` format.
  - Added `test-rerun-fails` target using `gotestsum --rerun-fails`.
  - Added `test-ci` target using `gotestsum --junitfile report.xml --format dots`.
  - Makefile test targets use `go run gotest.tools/gotestsum` for execution.
  - `clean` target updated to remove `report.xml` and `.gotestsum.json`.
- Updated GitHub Actions workflow (`.github/workflows/go.yml`):
  - Added step to `go install gotest.tools/gotestsum@v1.12.3`.
  - Test execution changed to `make test-ci`.
  - Added step to upload `report.xml` artifact.

This approach replaces the previous `tools.go` method for managing
`gotestsum` and aligns with the newer Go tooling standards.
@hangingman hangingman merged commit d179a18 into main Jun 26, 2025
1 check passed
@hangingman hangingman deleted the feature/integrate-gotestsum-go-tool-dep branch June 26, 2025 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants