SetRawExtension inserts b into the unknown fields of m. Deprecated: Use Message.ProtoReflect.SetUnknown instead.
(m Message, fnum int32, b []byte)
| 252 | // |
| 253 | // Deprecated: Use Message.ProtoReflect.SetUnknown instead. |
| 254 | func SetRawExtension(m Message, fnum int32, b []byte) { |
| 255 | mr := MessageReflect(m) |
| 256 | if mr == nil || !mr.IsValid() { |
| 257 | return |
| 258 | } |
| 259 | |
| 260 | // Verify that the raw field is valid. |
| 261 | for b0 := b; len(b0) > 0; { |
| 262 | num, _, n := protowire.ConsumeField(b0) |
| 263 | if int32(num) != fnum { |
| 264 | panic(fmt.Sprintf("mismatching field number: got %d, want %d", num, fnum)) |
| 265 | } |
| 266 | b0 = b0[n:] |
| 267 | } |
| 268 | |
| 269 | ClearExtension(m, &ExtensionDesc{Field: fnum}) |
| 270 | mr.SetUnknown(append(mr.GetUnknown(), b...)) |
| 271 | } |
| 272 | |
| 273 | // ExtensionDescs returns a list of extension descriptors found in m, |
| 274 | // containing descriptors for both populated extension fields in m and |