UnmarshalText reads a protocol buffer in Text format. UnmarshalText resets pb before starting to unmarshal, so any existing data in pb is always removed. If a required field is not set and no other error occurs, UnmarshalText returns *RequiredNotSetError.
(s string, pb Message)
| 1009 | // If a required field is not set and no other error occurs, |
| 1010 | // UnmarshalText returns *RequiredNotSetError. |
| 1011 | func UnmarshalText(s string, pb Message) error { |
| 1012 | if um, ok := pb.(encoding.TextUnmarshaler); ok { |
| 1013 | return um.UnmarshalText([]byte(s)) |
| 1014 | } |
| 1015 | pb.Reset() |
| 1016 | v := reflect.ValueOf(pb) |
| 1017 | return newTextParser(s).readStruct(v.Elem(), "") |
| 1018 | } |
searching dependent graphs…