MCPcopy
hub / github.com/gogo/protobuf / UnmarshalText

Function UnmarshalText

proto/text_parser.go:1011–1018  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

1009// If a required field is not set and no other error occurs,
1010// UnmarshalText returns *RequiredNotSetError.
1011func 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}

Callers 13

TestStringEscapingFunction · 0.92
TestUnmarshalGoldenFunction · 0.92
TestAmbiguousAnyFunction · 0.92
TestUnmarshalTextFunction · 0.85
TestRepeatedEnumFunction · 0.85
TestProto3TextParsingFunction · 0.85
TestMapParsingFunction · 0.85
TestOneofParsingFunction · 0.85
initFunction · 0.85

Calls 4

newTextParserFunction · 0.85
readStructMethod · 0.80
ResetMethod · 0.65
UnmarshalTextMethod · 0.45

Tested by 13

TestStringEscapingFunction · 0.74
TestUnmarshalGoldenFunction · 0.74
TestAmbiguousAnyFunction · 0.74
TestUnmarshalTextFunction · 0.68
TestRepeatedEnumFunction · 0.68
TestProto3TextParsingFunction · 0.68
TestMapParsingFunction · 0.68
TestOneofParsingFunction · 0.68
initFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…