Stringify attempts to create a reasonable string representation of types in the GitHub library. It does things like resolve pointers to their values and omits struct fields with nil values.
(message any)
| 25 | // the GitHub library. It does things like resolve pointers to their values |
| 26 | // and omits struct fields with nil values. |
| 27 | func Stringify(message any) string { |
| 28 | buf := bufferPool.Get().(*bytes.Buffer) |
| 29 | defer func() { |
| 30 | buf.Reset() |
| 31 | bufferPool.Put(buf) |
| 32 | }() |
| 33 | |
| 34 | v := reflect.ValueOf(message) |
| 35 | stringifyValue(buf, v) |
| 36 | return buf.String() |
| 37 | } |
| 38 | |
| 39 | // stringifyValue was heavily inspired by the goprotobuf library. |
| 40 |
searching dependent graphs…