🐹 Go Fan Report: stretchr/testify
Module Overview
testify is the de-facto standard assertion/mocking toolkit for Go, providing assert/require packages plus mock and suite packages that layer nicely on top of the standard testing package.
Current Usage in gh-aw-mcpg
This project uses testify extensively — it is our most heavily used direct dependency.
- Files: 303 files import
stretchr/testify
- Import Count: 295
testify/assert imports, 275 testify/require imports
- Key APIs Used (top usages):
assert.Equal (3061), require.NoError (2460), assert.Contains (1160), require.NotNil (920), require.Error (687), assert.True (684), assert.ErrorContains (546), require.True (498), assert.Nil (430), assert.False (418), assert.Empty (355), assert.Len (199), assert.ElementsMatch (71), assert.NotPanics (62), assert.ErrorIs (31)
- The AGENTS.md project convention already codifies testify best practices (assert vs require, bound asserters, specific assertions over generic ones), and a spot-check found no anti-patterns: no
assert.True(t, len(x)==0), no assert.Nil(t, err) for real errors, no assert.Equal(t, true, ...) style calls. Usage is already idiomatic.
testify/suite and testify/mock are not used at all in this codebase — all mocking is done manually (per AGENTS.md: "Mock external dependencies (Docker, network)").
Research Findings
Currently pinned: v1.11.1 (Aug 2025). Latest available: v1.12.1 (2026-08-19), with v1.12.0 released 2026-08-17.
Recent Updates
- v1.12.0:
assert.PanicsWithError now reports the actual error message on failure; assert.IsIncreasing/IsDecreasing family can return a bool without failing the test; very long objects are now truncated in failure messages (improves CI log readability); NotSubset failure messages fixed to use %#v instead of %q; mock.Return removed (irrelevant, we don't use mock); vendors pmezard/go-difflib and davecgh/go-spew to reduce external deps.
- v1.12.1: Swapped
gopkg.in/yaml.v3 for go.yaml.in/yaml/v3 — reduces external dependency surface and moves to the actively-maintained YAML fork. Testify's release notes call this "the first release which has the minimum dependencies practical."
Best Practices
Maintainers recommend preferring specific assertions (Empty, Len, Contains) over generic boolean checks for clearer failure output — this project already follows that convention. Bound asserters (assert.New(t)) are recommended for tests with many assertions — already used 218 times.
Improvement Opportunities
🏃 Quick Wins
- Bump
github.com/stretchr/testify from v1.11.1 → v1.12.1 in go.mod. Low-risk minor bump (no breaking API changes affecting assert/require) that picks up the long-object truncation improvement, helping CI output readability for large struct diffs (e.g. internal/config validation tests).
- Run
go get github.com/stretchr/testify@v1.12.1 && go mod tidy then re-run make test. Note the v1.12.1 yaml dependency swap changes an indirect dependency, so go.sum will need updating.
✨ Feature Opportunities
- None of the new v1.12.x features map to an immediate functional gap, but the improved long-object truncation directly helps the large config validation test suite that asserts on big struct diffs.
📐 Best Practice Alignment
- Already well aligned: assertions favor specific matchers over generic
True/Equal(true, ...) patterns, and require vs assert semantics are used correctly.
🔧 General Improvements
- Consider enabling
testifylint (available but disabled per .golangci.yml) on a per-package basis for newly-touched files, since existing code already conforms to its rules — providing a regression guard without a mass refactor.
Module Summary
Key Features
assert/require rich assertion library with 60+ matchers
mock package for interface mocking (unused here)
suite package for test suite lifecycle management (unused here)
- Now vendors
go-difflib/go-spew and uses go.yaml.in/yaml/v3 to minimize transitive deps
References
Recommendations
- Bump testify to v1.12.1 for improved failure-message readability and a leaner dependency tree.
- Run
go mod tidy and full test suite after the bump to catch any transitive yaml dependency issues.
- Optionally scope-enable
testifylint for new/modified files given existing code is already compliant.
Next Steps
- Open a small PR bumping the testify version and running
make agent-finished to validate.
- Track transitive
go.yaml.in/yaml/v3 addition in go.sum diffs during review.
Generated by Go Fan
Generated by Go Fan · auto · 46.3 AIC · ⊞ 11.9K · ◷
🐹 Go Fan Report: stretchr/testify
Module Overview
testifyis the de-facto standard assertion/mocking toolkit for Go, providingassert/requirepackages plusmockandsuitepackages that layer nicely on top of the standardtestingpackage.Current Usage in gh-aw-mcpg
This project uses testify extensively — it is our most heavily used direct dependency.
stretchr/testifytestify/assertimports, 275testify/requireimportsassert.Equal(3061),require.NoError(2460),assert.Contains(1160),require.NotNil(920),require.Error(687),assert.True(684),assert.ErrorContains(546),require.True(498),assert.Nil(430),assert.False(418),assert.Empty(355),assert.Len(199),assert.ElementsMatch(71),assert.NotPanics(62),assert.ErrorIs(31)assert.True(t, len(x)==0), noassert.Nil(t, err)for real errors, noassert.Equal(t, true, ...)style calls. Usage is already idiomatic.testify/suiteandtestify/mockare not used at all in this codebase — all mocking is done manually (per AGENTS.md: "Mock external dependencies (Docker, network)").Research Findings
Currently pinned:
v1.11.1(Aug 2025). Latest available: v1.12.1 (2026-08-19), with v1.12.0 released 2026-08-17.Recent Updates
assert.PanicsWithErrornow reports the actual error message on failure;assert.IsIncreasing/IsDecreasingfamily can return a bool without failing the test; very long objects are now truncated in failure messages (improves CI log readability);NotSubsetfailure messages fixed to use%#vinstead of%q;mock.Returnremoved (irrelevant, we don't usemock); vendorspmezard/go-difflibanddavecgh/go-spewto reduce external deps.gopkg.in/yaml.v3forgo.yaml.in/yaml/v3— reduces external dependency surface and moves to the actively-maintained YAML fork. Testify's release notes call this "the first release which has the minimum dependencies practical."Best Practices
Maintainers recommend preferring specific assertions (
Empty,Len,Contains) over generic boolean checks for clearer failure output — this project already follows that convention. Bound asserters (assert.New(t)) are recommended for tests with many assertions — already used 218 times.Improvement Opportunities
🏃 Quick Wins
github.com/stretchr/testifyfromv1.11.1→v1.12.1ingo.mod. Low-risk minor bump (no breaking API changes affectingassert/require) that picks up the long-object truncation improvement, helping CI output readability for large struct diffs (e.g.internal/configvalidation tests).go get github.com/stretchr/testify@v1.12.1 && go mod tidythen re-runmake test. Note the v1.12.1 yaml dependency swap changes an indirect dependency, sogo.sumwill need updating.✨ Feature Opportunities
📐 Best Practice Alignment
True/Equal(true, ...)patterns, andrequirevsassertsemantics are used correctly.🔧 General Improvements
testifylint(available but disabled per.golangci.yml) on a per-package basis for newly-touched files, since existing code already conforms to its rules — providing a regression guard without a mass refactor.Module Summary
github.com/stretchr/testifyv1.11.1(go.mod) → recommendv1.12.1Key Features
assert/requirerich assertion library with 60+ matchersmockpackage for interface mocking (unused here)suitepackage for test suite lifecycle management (unused here)go-difflib/go-spewand usesgo.yaml.in/yaml/v3to minimize transitive depsReferences
Recommendations
go mod tidyand full test suite after the bump to catch any transitive yaml dependency issues.testifylintfor new/modified files given existing code is already compliant.Next Steps
make agent-finishedto validate.go.yaml.in/yaml/v3addition ingo.sumdiffs during review.Generated by Go Fan