all: remove {Enum,Message,Extension}Type.GoType methods
These methods are difficult or impossible to use correctly; types
created by the dynamicpb package, for example, all have the same GoType.
Fixes golang/protobuf#938
Change-Id: I33d4ef381579ff18569b11df501d0ba7f38a6b5c
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/199060
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
diff --git a/internal/impl/extension.go b/internal/impl/extension.go
index 723bdb0..541f4a7 100644
--- a/internal/impl/extension.go
+++ b/internal/impl/extension.go
@@ -46,16 +46,12 @@
// Deprecated: Use the ExtendedType method instead.
ExtendedType piface.MessageV1
- // ExtensionType is zero value of the extension type.
+ // ExtensionType is the zero value of the extension type.
//
- // For historical reasons, reflect.TypeOf(ExtensionType) and Type.GoType
- // may not be identical:
- // * for scalars (except []byte), where ExtensionType uses *T,
- // while Type.GoType uses T.
- // * for repeated fields, where ExtensionType uses []T,
- // while Type.GoType uses *[]T.
+ // For historical reasons, reflect.TypeOf(ExtensionType) and the
+ // type returned by InterfaceOf may not be identical.
//
- // Deprecated: Use the GoType method instead.
+ // Deprecated: Use InterfaceOf(xt.Zero()) instead.
ExtensionType interface{}
// Field is the field number of the extension.
@@ -110,10 +106,6 @@
func (xi *ExtensionInfo) IsValidInterface(v interface{}) bool {
return xi.lazyInit().IsValidGo(reflect.ValueOf(v))
}
-func (xi *ExtensionInfo) GoType() reflect.Type {
- xi.lazyInit()
- return xi.goType
-}
func (xi *ExtensionInfo) TypeDescriptor() pref.ExtensionTypeDescriptor {
if atomic.LoadUint32(&xi.init) < extensionInfoDescInit {
xi.lazyInitSlow()