renderValue recursively renders a reflect.Value to the output builder
(val reflect.Value, title string, output *strings.Builder, depth int)
| 36 | |
| 37 | // renderValue recursively renders a reflect.Value to the output builder |
| 38 | func renderValue(val reflect.Value, title string, output *strings.Builder, depth int) { |
| 39 | // Dereference pointers |
| 40 | for val.Kind() == reflect.Pointer { |
| 41 | if val.IsNil() { |
| 42 | return |
| 43 | } |
| 44 | val = val.Elem() |
| 45 | } |
| 46 | |
| 47 | switch val.Kind() { |
| 48 | case reflect.Struct: |
| 49 | renderStruct(val, title, output, depth) |
| 50 | case reflect.Slice, reflect.Array: |
| 51 | renderSlice(val, title, output, depth) |
| 52 | case reflect.Map: |
| 53 | renderMap(val, title, output, depth) |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | // renderStruct renders a struct as markdown-style headers with key-value pairs |
| 58 | func renderStruct(val reflect.Value, title string, output *strings.Builder, depth int) { |
no test coverage detected