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

mock: document more alternatives to deprecated AnythingOfTypeArgument #1569

Merged
merged 2 commits into from Apr 23, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 19 additions & 1 deletion mock/mock.go
Expand Up @@ -766,7 +766,25 @@ const (
// AnythingOfTypeArgument contains the type of an argument
// for use when type checking. Used in Diff and Assert.
//
// Deprecated: this is an implementation detail that must not be used. Use [AnythingOfType] instead.
// Deprecated: this is an implementation detail that must not be used. Use the [AnythingOfType] constructor instead.
//
// If AnythingOfTypeArgument is used as a function return value type you can usually replace
// the function with a variable. Example:
//
// func anyString() mock.AnythingOfTypeArgument {
// return mock.AnythingOfType("string")
// }
//
// Can be replaced by:
//
// func anyString() interface{} {
// return mock.IsType("")
// }
//
// It could even be replaced with a variable:
//
// var anyString = mock.AnythingOfType("string")
// var anyString = mock.IsType("") // alternative
dolmen marked this conversation as resolved.
Show resolved Hide resolved
type AnythingOfTypeArgument = anythingOfTypeArgument

// anythingOfTypeArgument is a string that contains the type of an argument
Expand Down