Skip to content

Commit

Permalink
mock: simpler deprecation doc for AnythingOfTypeArgument
Browse files Browse the repository at this point in the history
Co-authored-by: Bracken <abdawson@gmail.com>
  • Loading branch information
dolmen and brackendawson committed Apr 23, 2024
1 parent aca1890 commit 8c324a0
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions mock/mock.go
Expand Up @@ -766,25 +766,15 @@ 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 the [AnythingOfType] constructor instead.
// Deprecated: this is an implementation detail that must not be used. Use the [AnythingOfType] constructor instead, example:
//
// If AnythingOfTypeArgument is used as a function return value type you can usually replace
// the function with a variable. Example:
// m.On("Do", mock.AnythingOfType("string"))
//
// func anyString() mock.AnythingOfTypeArgument {
// return mock.AnythingOfType("string")
// }
//
// Can be replaced by:
// All explicit type declarations can be replaced with interface{} as is expected by [Mock.On], example:
//
// func anyString() interface{} {
// return mock.IsType("")
// func anyString interface{} {
// return mock.AnythingOfType("string")
// }
//
// It could even be replaced with a variable:
//
// var anyString = mock.AnythingOfType("string")
// var anyString = mock.IsType("") // alternative
type AnythingOfTypeArgument = anythingOfTypeArgument

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

0 comments on commit 8c324a0

Please sign in to comment.