debugPrint prints the internal attribute map of the builder for debugging. This map cannot be printed by fmt.Printf() because it has cycles. A map contains a key: _parent, which pointer to is parent map, if any.
(v interface{}, level int)
| 1135 | // This map cannot be printed by fmt.Printf() because it has cycles. |
| 1136 | // A map contains a key: _parent, which pointer to is parent map, if any. |
| 1137 | func (b *Builder) debugPrint(v interface{}, level int) { |
| 1138 | |
| 1139 | switch vt := v.(type) { |
| 1140 | case map[string]interface{}: |
| 1141 | level += 3 |
| 1142 | fmt.Printf("\n") |
| 1143 | for mk, mv := range vt { |
| 1144 | if mk == AttribParentInternal { |
| 1145 | continue |
| 1146 | } |
| 1147 | fmt.Printf("%s%s:", strings.Repeat(" ", level), mk) |
| 1148 | b.debugPrint(mv, level) |
| 1149 | } |
| 1150 | case []map[string]interface{}: |
| 1151 | for _, v := range vt { |
| 1152 | b.debugPrint(v, level) |
| 1153 | } |
| 1154 | default: |
| 1155 | fmt.Printf(" %v (%T)\n", vt, vt) |
| 1156 | } |
| 1157 | } |