MCPcopy
hub / github.com/golang/protobuf / Init

Method Init

proto/properties.go:196–210  ·  view source on GitHub ↗

Init populates the properties from a protocol buffer struct tag. Deprecated: Do not use.

(typ reflect.Type, name, tag string, f *reflect.StructField)

Source from the content-addressed store, hash-verified

194//
195// Deprecated: Do not use.
196func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) {
197 p.Name = name
198 p.OrigName = name
199 if tag == "" {
200 return
201 }
202 p.Parse(tag)
203
204 if typ != nil && typ.Kind() == reflect.Map {
205 p.MapKeyProp = new(Properties)
206 p.MapKeyProp.Init(nil, "Key", f.Tag.Get("protobuf_key"), nil)
207 p.MapValProp = new(Properties)
208 p.MapValProp.Init(nil, "Value", f.Tag.Get("protobuf_val"), nil)
209 }
210}
211
212var propertiesCache sync.Map // map[reflect.Type]*StructProperties
213

Callers

nothing calls this directly

Calls 2

ParseMethod · 0.95
InitMethod · 0.65

Tested by

no test coverage detected