Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give mock.Anything its own type so it can't be mistaken for a string #1063

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dbravender
Copy link

Summary

This change makes mock.Anything its own type

Changes

  • Introduce a custom internal type for mock.Anything

Motivation

While refactoring tests to use strongly typed On_ calls generated by mockery with this PR vektra/mockery#375 I started getting unexpected test failures because some tests were using mock.Anything where a string was expected and the functions were receiving "mock.Anything" as the parameter. mock.Anything should have its own type to make situations like this a compile-time error. I don't believe this change should affect existing tests that use mock.Anything.

mock/mock.go Outdated Show resolved Hide resolved
@dolmen dolmen added pkg-mock Any issues related to Mock internal/refactor Refactor internals with no external visible changes labels Oct 31, 2023
@dolmen
Copy link
Collaborator

dolmen commented Oct 31, 2023

Related: #1441

@dolmen
Copy link
Collaborator

dolmen commented Oct 31, 2023

An alternate proposal: #1442

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal/refactor Refactor internals with no external visible changes pkg-mock Any issues related to Mock
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants