-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
expose accessor for value of unregistered extensions [dev] #483
expose accessor for value of unregistered extensions [dev] #483
Conversation
Rather than adding a new function, can we change |
It seems to me that this would be a forward compatible change since the current behavior is to panic since |
…iptors; remove GetRawExtension
@dsnet, done. PTAL |
proto/extensions.go
Outdated
@@ -293,14 +293,22 @@ func ClearExtension(pb Message, extension *ExtensionDesc) { | |||
|
|||
// GetExtension parses and returns the given extension of pb. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// GetExtension retrieves a proto2 extended field from pb.
//
// If the descriptor is type complete (i.e., ExtensionDesc.ExtensionType is non-nil),
// then GetExtension parses the encoded field and returns a Go value of the specified type.
// If the field is not present, then the default value is returned (if one is specified),
// otherwise ErrMissingExtension is reported.
//
// If the descriptor is not type complete (i.e., ExtensionDesc.ExtensionType is nil),
// then GetExtension returns the raw encoded bytes of the field extension.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@dsnet: I addressed your last comment. Is this ready to merge now? |
This is the same as #420, but for the
dev
branch. This would resolve #385.