Skip to content

mock: replace objx.Map with our own mock.TestData type to drop objx #1852#1870

Open
dolmen wants to merge 4 commits intomasterfrom
dolmen/mock-replace-objx.Map-1852
Open

mock: replace objx.Map with our own mock.TestData type to drop objx #1852#1870
dolmen wants to merge 4 commits intomasterfrom
dolmen/mock-replace-objx.Map-1852

Conversation

@dolmen
Copy link
Copy Markdown
Collaborator

@dolmen dolmen commented Apr 8, 2026

Summary

Fix use of objx.Map in the signature of mock.Mock.TestData().

Drop github.com/stretchr/objx dependency.

This implements proposal #1852.

Changes

Motivation

This allows to drop the dependency on the objx module.

Benefits:

  • one less dependency = faster compile time for users of the testify/mock package
  • reduce supply chain risks (even if objx is in the same GitHub organization, it is maintained by different person who have never met).

Related issues

Closes #1852

dolmen added 4 commits April 8, 2026 18:09
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.
@dolmen dolmen added the dependencies Pull requests that update a dependency file label Apr 8, 2026
@dolmen dolmen requested a review from ccoVeille April 8, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mock: replace objx.Map with our own mock.TestData type to drop objx

2 participants