renderInlineEmbeddedFields renders the fields of an anonymous embedded struct directly into the parent struct output, flattening the hierarchy.
(val reflect.Value, maxFieldLen int, output *strings.Builder, depth int)
| 77 | // renderInlineEmbeddedFields renders the fields of an anonymous embedded struct |
| 78 | // directly into the parent struct output, flattening the hierarchy. |
| 79 | func renderInlineEmbeddedFields(val reflect.Value, maxFieldLen int, output *strings.Builder, depth int) { |
| 80 | walkInlineFields(val, func(field reflect.Value, fieldType reflect.StructField) { |
| 81 | tag := parseConsoleTag(fieldType.Tag.Get("console")) |
| 82 | if tag.skip { |
| 83 | return |
| 84 | } |
| 85 | if tag.omitempty && isZeroValue(field) { |
| 86 | return |
| 87 | } |
| 88 | |
| 89 | fieldName := fieldType.Name |
| 90 | if tag.header != "" { |
| 91 | fieldName = tag.header |
| 92 | } |
| 93 | |
| 94 | renderStructField(field, fieldName, tag, maxFieldLen, output, depth) |
| 95 | }) |
| 96 | } |
| 97 | |
| 98 | // computeMaxFieldLen computes the longest visible field name for alignment, |
| 99 | // recursing into anonymous embedded structs to include their fields. |
no test coverage detected