mock: replace objx.Map with our own mock.TestData type to drop objx #1852#1870
Open
mock: replace objx.Map with our own mock.TestData type to drop objx #1852#1870
Conversation
In order to ease maintenance of downstream forks of Testify that would remove dependency on github.com/stretchr/objx we move all uses of that module in isolated source files. A fork without that dependency could just remove those files. See #1752 (comment) The use of objx is quite contained: it is only used in Mock.TestData(). Note that we can't just remove that method or change the return value because that would be a breaking change.
Add build tag testify_no_objx to allow to exclude method Mock.TestData() for avoiding dependency on github.com/stretchr/objx.
Drop the last reference to dependency github.com/stretchr/objx. Reference to objx.Map is removed (BREAKING CHANGE) from the Mock.TestData method signature. A similar object is returned instead of objx.Map, but we do not aim to implement the full objx.Value API: instead we expose the reflect.Value API that should help enough the few users of Mock.TestData to move away from objx.Map reliance. Implemented as planned in #1852.
ccoVeille
approved these changes
Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix use of
objx.Mapin the signature ofmock.Mock.TestData().Drop
github.com/stretchr/objxdependency.This implements proposal #1852.
Changes
go mod tidyremoves the dependencyMotivation
This allows to drop the dependency on the objx module.
Benefits:
testify/mockpackageRelated issues
Closes #1852