internal/impl: clean up obsolete ExtensionInfo fields/funcs

This is change 5/5 in a series of commits changing protoV1.ExtensionDesc
to directly implement protoreflect.ExtensionType.

1. [v2] Add protoimpl.ExtensionInfo as an alias for
   protoiface.ExtensionDescV1.

2. [v1] Update references to protoimpl.ExtensionInfo to use
   protoiface.ExtensionInfo.

3. [v2] Create protoimpl.ExtensionInfo (an alias to a new type in
   the impl package) and remove protoiface.ExtensionDescV1.

4. [v1] Remove unneeded explicit conversions between ExtensionDesc and
   ExtensionType (since the former now directly implements the latter).

5. [v2] Remove stub conversion functions.

Change-Id: I1fdfb18c481e72a362a6f9ee0e440f8f909790ca
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/189564
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
This commit is contained in:
Damien Neil 2019-08-09 09:50:14 -07:00
parent f1e905b042
commit f247a903b9
6 changed files with 6 additions and 13 deletions

View File

@ -1,7 +1,7 @@
module google.golang.org/protobuf/cmd/protoc-gen-go-grpc/testdata
require (
github.com/golang/protobuf v1.2.1-0.20190820204156-2da1b93405dd
github.com/golang/protobuf v1.2.1-0.20190820213554-ae1d65bc5435
google.golang.org/grpc v1.19.0
google.golang.org/protobuf v1.0.0
)

View File

@ -1,7 +1,7 @@
module google.golang.org/protobuf/cmd/protoc-gen-go/testdata
require (
github.com/golang/protobuf v1.2.1-0.20190820204156-2da1b93405dd
github.com/golang/protobuf v1.2.1-0.20190820213554-ae1d65bc5435
google.golang.org/protobuf v1.0.0
)

2
go.mod
View File

@ -3,6 +3,6 @@ module google.golang.org/protobuf
go 1.9
require (
github.com/golang/protobuf v1.2.1-0.20190820204156-2da1b93405dd
github.com/golang/protobuf v1.2.1-0.20190820213554-ae1d65bc5435
github.com/google/go-cmp v0.3.0
)

3
go.sum
View File

@ -10,6 +10,8 @@ github.com/golang/protobuf v1.2.1-0.20190806214225-7037721e6de0 h1:a3hJDGxxWRbPx
github.com/golang/protobuf v1.2.1-0.20190806214225-7037721e6de0/go.mod h1:tDQPRlaHYu9yt1wPgdx85inRiLvUCuJZXsYjC0mwc1c=
github.com/golang/protobuf v1.2.1-0.20190820204156-2da1b93405dd h1:KtPU12Q37ryZW+7L97q/3GAhHtFXRjEkulcRj4dnSvA=
github.com/golang/protobuf v1.2.1-0.20190820204156-2da1b93405dd/go.mod h1:x87I3ou7ehf/yR6iQ88MkyDogdxXN04TELJ7HVy7V7I=
github.com/golang/protobuf v1.2.1-0.20190820213554-ae1d65bc5435 h1:mh1ym3CXIEzWTZlfDucUHHIbroKZ8ri4E3dbxu80las=
github.com/golang/protobuf v1.2.1-0.20190820213554-ae1d65bc5435/go.mod h1:k7dGkiTZ3rjVDhKSpGt+x1zDzAePJk4jdhoBwIkQgBo=
github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
google.golang.org/protobuf v0.0.0-20190514172829-e89e6244e0e8/go.mod h1:791zQGC15vDqjpmPRn1uGPu5oHy/Jzw/Q1n5JsgIIcY=
@ -22,3 +24,4 @@ google.golang.org/protobuf v0.0.0-20190617175724-bd7b7a9e0c26/go.mod h1:+FOB8T5/
google.golang.org/protobuf v0.0.0-20190620020611-d888139e7b59/go.mod h1:of3pt14Y+dOxz2tBOHXEoapPpKFC15/0zWhPAddkfsU=
google.golang.org/protobuf v0.0.0-20190717230113-f647c82cc3c7/go.mod h1:yGm7aNHn9Bp1NIvj6+CVUkcJshu+Usshfd3A+YxEuI8=
google.golang.org/protobuf v0.0.0-20190820203659-c0f8c0a24ece/go.mod h1:tRqhEyKwbKqwt5CQZAuOtj09RfhLNklDOhndhYA9blU=
google.golang.org/protobuf v0.0.0-20190820213257-f1e905b04207/go.mod h1:UJqt2ZERO8/qk5A9t8Ujq6OJ+MNvOQpg9X4RKyYz9Ho=

View File

@ -93,10 +93,3 @@ func (Export) MessageStringOf(m pref.ProtoMessage) string {
func (Export) ExtensionDescFromType(t pref.ExtensionType) *ExtensionInfo {
return legacyExtensionDescFromType(t)
}
// ExtensionTypeFromDesc returns the v2 protoreflect.ExtensionType for d.
//
// TODO: Remove after updating v1 to no longer call this.
func (Export) ExtensionTypeFromDesc(d *ExtensionInfo) pref.ExtensionType {
return d
}

View File

@ -43,9 +43,6 @@ type ExtensionInfo struct {
goType reflect.Type
conv Converter
// TODO: Remove after updating v2 to not set this.
Type interface{}
// ExtendedType is a typed nil-pointer to the parent message type that
// is being extended. It is possible for this to be unpopulated in v2
// since the message may no longer implement the MessageV1 interface.