@@ -43,7 +43,7 @@ var errNotExtendable = errors.New("proto: not an extendable proto.Message")
4343// HasExtension reports whether the extension field is present in m
4444// either as an explicitly populated field or as an unknown field.
4545func HasExtension (m Message , xt * ExtensionDesc ) (has bool ) {
46- mr := protoimpl . X . MessageOf (m )
46+ mr := MessageReflect (m )
4747 if mr == nil || ! mr .IsValid () {
4848 return false
4949 }
@@ -71,7 +71,7 @@ func HasExtension(m Message, xt *ExtensionDesc) (has bool) {
7171// ClearExtension removes the the exntesion field from m
7272// either as an explicitly populated field or as an unknown field.
7373func ClearExtension (m Message , xt * ExtensionDesc ) {
74- mr := protoimpl . X . MessageOf (m )
74+ mr := MessageReflect (m )
7575 if mr == nil || ! mr .IsValid () {
7676 return
7777 }
@@ -94,7 +94,7 @@ func ClearExtension(m Message, xt *ExtensionDesc) {
9494// ClearAllExtensions clears all extensions from m.
9595// This includes populated fields and unknown fields in the extension range.
9696func ClearAllExtensions (m Message ) {
97- mr := protoimpl . X . MessageOf (m )
97+ mr := MessageReflect (m )
9898 if mr == nil || ! mr .IsValid () {
9999 return
100100 }
@@ -118,7 +118,7 @@ func ClearAllExtensions(m Message) {
118118// If the descriptor is type incomplete (i.e., ExtensionDesc.ExtensionType is nil),
119119// then GetExtension returns the raw encoded bytes for the extension field.
120120func GetExtension (m Message , xt * ExtensionDesc ) (interface {}, error ) {
121- mr := protoimpl . X . MessageOf (m )
121+ mr := MessageReflect (m )
122122 if mr == nil || ! mr .IsValid () || mr .Descriptor ().ExtensionRanges ().Len () == 0 {
123123 return nil , errNotExtendable
124124 }
@@ -200,7 +200,7 @@ func (r extensionResolver) FindExtensionByNumber(message protoreflect.FullName,
200200// corresponding with the provided list of extension descriptors, xts.
201201// If an extension is missing in m, the corresponding value is nil.
202202func GetExtensions (m Message , xts []* ExtensionDesc ) ([]interface {}, error ) {
203- mr := protoimpl . X . MessageOf (m )
203+ mr := MessageReflect (m )
204204 if mr == nil || ! mr .IsValid () {
205205 return nil , errNotExtendable
206206 }
@@ -221,7 +221,7 @@ func GetExtensions(m Message, xts []*ExtensionDesc) ([]interface{}, error) {
221221
222222// SetExtension sets an extension field in m to the provided value.
223223func SetExtension (m Message , xt * ExtensionDesc , v interface {}) error {
224- mr := protoimpl . X . MessageOf (m )
224+ mr := MessageReflect (m )
225225 if mr == nil || ! mr .IsValid () || mr .Descriptor ().ExtensionRanges ().Len () == 0 {
226226 return errNotExtendable
227227 }
@@ -252,7 +252,7 @@ func SetExtension(m Message, xt *ExtensionDesc, v interface{}) error {
252252//
253253// Deprecated: Use Message.ProtoReflect.SetUnknown instead.
254254func SetRawExtension (m Message , fnum int32 , b []byte ) {
255- mr := protoimpl . X . MessageOf (m )
255+ mr := MessageReflect (m )
256256 if mr == nil || ! mr .IsValid () {
257257 return
258258 }
@@ -277,7 +277,7 @@ func SetRawExtension(m Message, fnum int32, b []byte) {
277277// the ExtensionDesc.Field field is populated.
278278// The order of the extension descriptors is undefined.
279279func ExtensionDescs (m Message ) ([]* ExtensionDesc , error ) {
280- mr := protoimpl . X . MessageOf (m )
280+ mr := MessageReflect (m )
281281 if mr == nil || ! mr .IsValid () || mr .Descriptor ().ExtensionRanges ().Len () == 0 {
282282 return nil , errNotExtendable
283283 }
0 commit comments