Closed
Description
Coming from #41882, @ianlancetaylor suggests adding:
func IsEmptyInterface(t reflect.Type) bool
to reflect
package to detect empty interface.
Currently, users (including standard libraries, Google internal code, are relying on reflect.Type.NumMethod() == 0
to check empty interface, which is wrong. After #22075 is fixed, code which uses wrong behavior should be changed to:
reflect.TypeOf((*interface{})(nil)).Elem().Implements(T)
Adding reflect.IsEmptyInterface
will help user's migration easier.