mock: document more alternatives to deprecated AnythingOfTypeArgument

pull/1569/head
Olivier Mengué 2024-03-07 11:59:12 +01:00
parent 632a26080f
commit aca1890ec1
1 changed files with 19 additions and 1 deletions

View File

@ -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
type AnythingOfTypeArgument = anythingOfTypeArgument
// anythingOfTypeArgument is a string that contains the type of an argument