github cweill/gotests v1.7.0
v1.7.0 - Major Modernization Release

latest releases: v1.8.0, v1.7.4, v1.7.3...
one day ago

v1.7.0 - Major Modernization Release

After 5 years since v1.6.0, we're excited to release v1.7.0 with major improvements and modernizations! 🎉

✨ New Features

Recursive Directory Support

You can now generate tests for entire directory trees using the ... pattern:

gotests -all pkg/...

This will recursively generate tests for all Go files in the pkg directory and its subdirectories. Fixes #186.

Cleaner Generated Code

Generated tests now use Go 1.22+ loop variable scoping, eliminating the need for the tt := tt shadowing pattern. Tests are now cleaner and more readable.

Better Error Handling

Subtests with return values now use t.Fatalf() instead of t.Errorf() + return, providing clearer test failure semantics and preventing misleading output. Thanks to PR #184.

🔧 Improvements

BREAKING: Minimum Go Version

  • Minimum Go version increased from 1.6 to 1.22
  • Leverages modern Go features for cleaner generated code
  • Aligns with Go's official support policy

Dependency Reduction

  • Replaced third-party bindata tools with stdlib embed package (PR #181)
  • Removed 834+ lines of generated code
  • Simplified build process - no more go generate needed
  • Better maintainability and reduced external dependencies

Bug Fixes

  • Fixed import path bug when receiver types and methods are in different files (PR #179)
  • Now correctly collects imports from all files in the package
  • Prevents compilation errors in generated test files

Template Improvements

  • Proper t.Parallel() placement at top-level test functions (fixes #188)
  • Satisfies tparallel linter requirements
  • Better parallel test execution

Documentation & Installation

  • Updated README to use go install instead of deprecated go get (PR #180)
  • Documented the -named flag for map-based table tests (PR #185)
  • Added CHANGELOG.md for tracking changes
  • Added CLAUDE.md for AI-assisted development

📦 CI/CD Updates

  • Updated GitHub Actions to test Go 1.22.x, 1.23.x, 1.24.x, and 1.25.x
  • Modernized actions: setup-go v2→v5, checkout v2→v4
  • Simplified coverage reporting with coverallsapp/github-action@v2
  • Fixed bot commit support for automated workflows

📊 Statistics

  • 834+ lines of generated bindata code removed
  • 5 PRs integrated
  • 2 issues fixed
  • 4 Go versions tested in CI (was 8, now focused on recent versions)

🙏 Thanks

Special thanks to the contributors whose PRs were integrated in this release:

  • PR #184 (t.Fatalf improvement)
  • PR #185 (documentation)
  • PR #180 (go install)
  • PR #181 (embed package)
  • PR #179 (import fix)

And to everyone who reported issues and helped maintain this project!

📝 Installation

go install github.com/cweill/gotests/gotests@latest

🔗 Full Changelog

See CHANGELOG.md for complete details.

Don't miss a new gotests release

NewReleases is sending notifications on new releases.