From 5c0c2a96db31d6730689ffa062478bbe317f69c8 Mon Sep 17 00:00:00 2001 From: Mario de Frutos Dieguez Date: Fri, 26 Jun 2020 20:16:02 +0200 Subject: [PATCH] Make the example in the documentation work To make the example work we need to include the element to be casted --- gomock/matchers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gomock/matchers.go b/gomock/matchers.go index 7bfc07be..cf5566ef 100644 --- a/gomock/matchers.go +++ b/gomock/matchers.go @@ -245,7 +245,7 @@ func Not(x interface{}) Matcher { // AssignableToTypeOf(s).Matches(time.Second) // returns true // AssignableToTypeOf(s).Matches(99) // returns false // -// var ctx = reflect.TypeOf((*context.Context)).Elem() +// var ctx = reflect.TypeOf((*context.Context)(nil)).Elem() // AssignableToTypeOf(ctx).Matches(context.Background()) // returns true func AssignableToTypeOf(x interface{}) Matcher { if xt, ok := x.(reflect.Type); ok {