Skip to content

Conversation

@a2not
Copy link

@a2not a2not commented Nov 8, 2025

Summary

Update documentation comments in require.go to use assert.CollectT instead of require.CollectT in EventuallyWithT and EventuallyWithTf examples. This clarifies the intended usage and prevents confusion for users.

Changes

Motivation

The documentation was confusing since it uses non-existent type.

Related issues

@a2not
Copy link
Author

a2not commented Nov 8, 2025

Oops. I didn't know that it was in generated file.
I'll think of another approach then.

@a2not a2not closed this Nov 8, 2025
@a2not a2not reopened this Nov 8, 2025
Update replace funcmap to replace "assert." with "require." while preserving
"*assert.CollectT" references. This prevents unintended replacement of
pointer references to CollectT, ensuring correct code generation.

Signed-off-by: a2not <[email protected]>
@a2not a2not force-pushed the fix-doc-require_collect-not-exist branch from 1e61e54 to a39aa2d Compare November 8, 2025 03:30
a2not added 2 commits November 8, 2025 12:36
Refactored the Replace function in _codegen/main.go to support preserving
multiple identifiers, not just "*assert.CollectT". Updated usage in
require/require.go to reflect new placeholder format. This improves
extensibility and maintainability for future identifier additions.

Signed-off-by: a2not <[email protected]>
Update placeholder generation to use uppercase and replace dots with underscores,
ensuring consistency and preventing accidental replacement of preserved identifiers.
Also update documentation examples in require.go to use correct types.

Signed-off-by: a2not <[email protected]>
Comment on lines 301 to 303
identifiersToBePreserved := []string{
"*assert.CollectT",
}
Copy link
Author

@a2not a2not Nov 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be over-generalizing things, since so far we only want to preserve one keyword.
Let me know if I need to simplify this so that it only cares about assert.CollectT like a39aa2d#diff-4b4cb0af6b5935c8adcb9f00b426367349e989296edf13eee95831c4bb93c831R299-R310.

Remove pointer from "assert.CollectT" in identifiersToBePreserved to ensure
correct string replacement behavior in testFunc.Replace. This prevents
unintended placeholder substitution for pointer types.

Signed-off-by: a2not <[email protected]>
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.

1 participant