currentKey reconstructs the full TOML key being processed from the decoder's path. When withTableKey is true, d.path contains only the key-value parts (the table target is cached) and the table key is prepended.
(withTableKey bool)
| 474 | // path. When withTableKey is true, d.path contains only the key-value parts |
| 475 | // (the table target is cached) and the table key is prepended. |
| 476 | func (d *decoder) currentKey(withTableKey bool) Key { |
| 477 | n := len(d.path) |
| 478 | if withTableKey { |
| 479 | n += len(d.tableKey) |
| 480 | } |
| 481 | key := make(Key, 0, n) |
| 482 | if withTableKey { |
| 483 | key = append(key, d.tableKey...) |
| 484 | } |
| 485 | for i := range d.path { |
| 486 | key = append(key, d.path[i].str()) |
| 487 | } |
| 488 | return key |
| 489 | } |
| 490 | |
| 491 | func (d *decoder) unmarshal(data []byte, v interface{}) error { |
| 492 | r := reflect.ValueOf(v) |