(i interface{})
| 21 | ) |
| 22 | |
| 23 | func flatten(i interface{}) (map[string]interface{}, error) { |
| 24 | result := make(map[string]interface{}) |
| 25 | err := flattenValue(reflect.ValueOf(i), "", result) |
| 26 | return result, err |
| 27 | } |
| 28 | |
| 29 | func flattenValue(v reflect.Value, prefix string, m map[string]interface{}) error { |
| 30 | switch v.Kind() { |