DebugString returns a detailed dump of the type protobuf struct, suitable for debugging scenarios.
()
| 2286 | // DebugString returns a detailed dump of the type protobuf struct, suitable for |
| 2287 | // debugging scenarios. |
| 2288 | func (t *T) DebugString() string { |
| 2289 | if t.Family() == ArrayFamily && t.ArrayContents().UserDefined() { |
| 2290 | // In the case that this type is an array that contains a user defined |
| 2291 | // type, the introspection that protobuf performs to generate a string |
| 2292 | // representation will panic if the UserDefinedTypeMetadata field of the |
| 2293 | // type is populated. It seems to not understand that fields in the element |
| 2294 | // T could be not generated by proto, and panics trying to operate on the |
| 2295 | // TypeMeta field of the T. To get around this, we just deep copy the T and |
| 2296 | // zero out the type metadata to placate proto. See the following issue for |
| 2297 | // details: https://github.com/gogo/protobuf/issues/693. |
| 2298 | internalTypeCopy := protoutil.Clone(&t.InternalType).(*InternalType) |
| 2299 | internalTypeCopy.ArrayContents.TypeMeta = UserDefinedTypeMetadata{} |
| 2300 | return internalTypeCopy.String() |
| 2301 | } |
| 2302 | return t.InternalType.String() |
| 2303 | } |
| 2304 | |
| 2305 | // IsAmbiguous returns true if this type is in UnknownFamily or AnyFamily. |
| 2306 | // Instances of ambiguous types can be NULL or be in one of several different |
nothing calls this directly
no test coverage detected