diff --git a/src/reflect/type.go b/src/reflect/type.go index 828cf12e2..884f89dc8 100644 --- a/src/reflect/type.go +++ b/src/reflect/type.go @@ -127,6 +127,11 @@ type Method struct { Index int // index for Type.Method } +// IsExported reports whether the method is exported. +func (m Method) IsExported() bool { + return m.PkgPath == "" +} + // The following Type type has been copied almost entirely from // https://github.com/golang/go/blob/go1.15/src/reflect/type.go#L27-L212. // Some methods have been commented out as they haven't yet been implemented.