You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
testify is the de facto standard Go testing toolkit, providing rich assertion libraries (assert, require), mock support (mock), and test suites (suite). It dramatically improves test readability and error messages over the raw testing package.
Version in use: v1.11.1 (latest)
Current Usage in gh-aw-mcpg
This project is a heavy testify user — it's the backbone of the entire test suite:
Files: 182 test files import testify
Sub-packages used:
assert — 175 import occurrences
require — 159 import occurrences
mock — 0 uses
suite — 0 uses
Total assert/require calls: ~8,433 across the codebase
Bound asserter pattern (assert.New(t)): used in 30 files; 152 files use non-bound form
The project is already on the latest version and makes excellent use of the core APIs. The high test coverage and consistent use of require for critical checks vs assert for non-critical ones reflects good practice.
Research Findings
Best Practices from Maintainers
Prefer assert.NoError(t, err) over assert.Nil(t, err) — produces much better failure messages: "Received unexpected error: <err>" vs just "Expected nil"
Prefer assert.Error(t, err) over assert.NotNil(t, err) for error assertions
Use bound asserters (assert := assert.New(t)) when a function has many assertions to reduce t repetition
Use assert.ErrorIs / assert.ErrorAs for sentinel error checking (v1.10+)
Improvement Opportunities
🏃 Quick Wins
~22 uses of Nil/NotNil on error values that should use semantic error assertions:
Current Pattern
Better Pattern
Benefit
require.Nil(t, err)
require.NoError(t, err)
Better failure message
assert.Nil(t, err)
assert.NoError(t, err)
Better failure message
require.NotNil(t, err)
require.Error(t, err)
Clearer intent
Examples found:
// internal/middleware/jqschema_test.go:117require.Nil(jqSchemaCompileErr, "jq schema filter must compile without error")
// → require.NoError(t, jqSchemaCompileErr, "jq schema filter must compile without error")// internal/mcp/http_transport_test.go:982require.Nil(t, resp.Error, "response should not contain an error after reconnect")
// → require.NoError(t, resp.Error, ...) (if resp.Error implements error)
Files affected:
internal/middleware/jqschema_test.go
internal/mcp/http_transport_test.go
internal/mcp/http_connection_test.go
internal/launcher/getorlaunch_timeout_test.go
internal/launcher/getorlaunchforsession_test.go
and ~15 more
✨ Feature Opportunities
assert.ErrorIs and assert.ErrorAs (available since v1.10, already on v1.11.1):
The project uses EqualError (13 uses) and ErrorContains for error message checks
For sentinel errors (errors.Is-style checks), assert.ErrorIs gives cleaner tests and better error messages
Example: replace assert.EqualError(t, err, someErr.Error()) with assert.ErrorIs(t, err, someErr)
testify/mock package (available, currently unused):
If interfaces need mocking in future tests, the mock package is already in the dependency tree — no new dep required
📐 Best Practice Alignment
Inconsistent bound vs non-bound asserter style: The AGENTS.md recommends bound asserters for tests with multiple assertions, but only 30/182 test files use them. This is a minor inconsistency — not a bug, but standardizing would reduce t argument noise. The codebase mixes both styles freely.
assert.Nil(result, "msg") without t: Some tests use bound asserter form without calling assert.New(t) first (inheriting from outer scope). These are fine where the bound asserter was set up, but worth double-checking for correctness.
🔧 General Improvements
assert.ElementsMatch is already well-used (61 occurrences) — great for unordered slice comparisons ✅
assert.JSONEq usage is present — good for JSON comparison without formatting concerns ✅
EqualError (13 uses) vs ErrorContains — both used appropriately ✅
Recommendations
[Low effort, high value] Replace assert.Nil(t, err) → assert.NoError(t, err) and require.Nil(t, err) → require.NoError(t, err) throughout the codebase (~22 occurrences). Can be done with a targeted sed/gorename pass.
[Low effort] Replace assert.NotNil(t, err) → assert.Error(t, err) for the few error-checking cases.
[Consider] Evaluate assert.ErrorIs for sentinel error tests where EqualError currently compares error strings.
Next Steps
Run golangci-lint run --enable=testifylint to automatically detect all testify anti-patterns (testifylint is currently disabled in .golangci.yml due to "requiring extensive test refactoring")
Consider enabling testifylint as a non-blocking lint suggestion to catch new anti-patterns going forward
Generated by Go Fan 🐹 Round §24878212116 — module 5 in rotation
https://github.com/stretchr/testifysearch_repositories: has lower integrity than agent requires. The agent cannot read data with integrity below "unapproved".
stretchr/testify@5f80e4alist_commits: has lower integrity than agent requires. The agent cannot read data with integrity below "unapproved".
wazero/wazero@5cb4bb3list_commits: has lower integrity than agent requires. The agent cannot read data with integrity below "unapproved".
santhosh-tekuri/jsonschema@180cde3list_commits: has lower integrity than agent requires. The agent cannot read data with integrity below "unapproved".
🐹 Go Fan Report: stretchr/testify
Module Overview
testify is the de facto standard Go testing toolkit, providing rich assertion libraries (
assert,require), mock support (mock), and test suites (suite). It dramatically improves test readability and error messages over the rawtestingpackage.Version in use:
v1.11.1(latest)Current Usage in gh-aw-mcpg
This project is a heavy testify user — it's the backbone of the entire test suite:
assert— 175 import occurrencesrequire— 159 import occurrencesmock— 0 usessuite— 0 usesassert.New(t)): used in 30 files; 152 files use non-bound formThe project is already on the latest version and makes excellent use of the core APIs. The high test coverage and consistent use of
requirefor critical checks vsassertfor non-critical ones reflects good practice.Research Findings
Best Practices from Maintainers
assert.NoError(t, err)overassert.Nil(t, err)— produces much better failure messages:"Received unexpected error: <err>"vs just"Expected nil"assert.Error(t, err)overassert.NotNil(t, err)for error assertionsassert := assert.New(t)) when a function has many assertions to reducetrepetitionassert.ErrorIs/assert.ErrorAsfor sentinel error checking (v1.10+)Improvement Opportunities
🏃 Quick Wins
~22 uses of
Nil/NotNilon error values that should use semantic error assertions:require.Nil(t, err)require.NoError(t, err)assert.Nil(t, err)assert.NoError(t, err)require.NotNil(t, err)require.Error(t, err)Examples found:
Files affected:
internal/middleware/jqschema_test.gointernal/mcp/http_transport_test.gointernal/mcp/http_connection_test.gointernal/launcher/getorlaunch_timeout_test.gointernal/launcher/getorlaunchforsession_test.go✨ Feature Opportunities
assert.ErrorIsandassert.ErrorAs(available since v1.10, already on v1.11.1):EqualError(13 uses) andErrorContainsfor error message checkserrors.Is-style checks),assert.ErrorIsgives cleaner tests and better error messagesassert.EqualError(t, err, someErr.Error())withassert.ErrorIs(t, err, someErr)testify/mockpackage (available, currently unused):📐 Best Practice Alignment
Inconsistent bound vs non-bound asserter style: The AGENTS.md recommends bound asserters for tests with multiple assertions, but only 30/182 test files use them. This is a minor inconsistency — not a bug, but standardizing would reduce
targument noise. The codebase mixes both styles freely.assert.Nil(result, "msg")withoutt: Some tests use bound asserter form without callingassert.New(t)first (inheriting from outer scope). These are fine where the bound asserter was set up, but worth double-checking for correctness.🔧 General Improvements
assert.ElementsMatchis already well-used (61 occurrences) — great for unordered slice comparisons ✅assert.JSONEqusage is present — good for JSON comparison without formatting concerns ✅EqualError(13 uses) vsErrorContains— both used appropriately ✅Recommendations
[Low effort, high value] Replace
assert.Nil(t, err)→assert.NoError(t, err)andrequire.Nil(t, err)→require.NoError(t, err)throughout the codebase (~22 occurrences). Can be done with a targeted sed/gorename pass.[Low effort] Replace
assert.NotNil(t, err)→assert.Error(t, err)for the few error-checking cases.[Consider] Evaluate
assert.ErrorIsfor sentinel error tests whereEqualErrorcurrently compares error strings.Next Steps
golangci-lint run --enable=testifylintto automatically detect all testify anti-patterns (testifylint is currently disabled in.golangci.ymldue to "requiring extensive test refactoring")testifylintas a non-blocking lint suggestion to catch new anti-patterns going forwardGenerated by Go Fan 🐹
Round §24878212116 — module 5 in rotation
References:
Note
🔒 Integrity filter blocked 7 items
The following items were blocked because they don't meet the GitHub integrity level.
search_repositories: has lower integrity than agent requires. The agent cannot read data with integrity below "unapproved".search_repositories: has lower integrity than agent requires. The agent cannot read data with integrity below "unapproved".search_repositories: has lower integrity than agent requires. The agent cannot read data with integrity below "unapproved".list_commits: has lower integrity than agent requires. The agent cannot read data with integrity below "unapproved".list_commits: has lower integrity than agent requires. The agent cannot read data with integrity below "unapproved".list_commits: has lower integrity than agent requires. The agent cannot read data with integrity below "unapproved".get_latest_release: has lower integrity than agent requires. The agent cannot read data with integrity below "unapproved".To allow these resources, lower
min-integrityin your GitHub frontmatter: