DebugString returns a detailed dump of the type protobuf struct, suitable for debugging scenarios.
()
| 2818 | // DebugString returns a detailed dump of the type protobuf struct, suitable for |
| 2819 | // debugging scenarios. |
| 2820 | func (t *T) DebugString() string { |
| 2821 | if t.Family() == ArrayFamily && t.ArrayContents().UserDefined() { |
| 2822 | // In the case that this type is an array that contains a user defined |
| 2823 | // type, the introspection that protobuf performs to generate a string |
| 2824 | // representation will panic if the UserDefinedTypeMetadata field of the |
| 2825 | // type is populated. It seems to not understand that fields in the element |
| 2826 | // T could be not generated by proto, and panics trying to operate on the |
| 2827 | // TypeMeta field of the T. To get around this, we just deep copy the T and |
| 2828 | // zero out the type metadata to placate proto. See the following issue for |
| 2829 | // details: https://github.com/gogo/protobuf/issues/693. |
| 2830 | internalTypeCopy := protoutil.Clone(&t.InternalType).(*InternalType) |
| 2831 | internalTypeCopy.ArrayContents.TypeMeta = UserDefinedTypeMetadata{} |
| 2832 | return internalTypeCopy.String() |
| 2833 | } |
| 2834 | return t.InternalType.String() |
| 2835 | } |
| 2836 | |
| 2837 | // IsAmbiguous returns true if this type is in UnknownFamily or AnyFamily. |
| 2838 | // Instances of ambiguous types can be NULL or be in one of several different |
nothing calls this directly
no test coverage detected