(ctx context.Context, item MapItem, column int)
| 638 | } |
| 639 | |
| 640 | func (e *Encoder) encodeMapItem(ctx context.Context, item MapItem, column int) (*ast.MappingValueNode, error) { |
| 641 | k := reflect.ValueOf(item.Key) |
| 642 | v := reflect.ValueOf(item.Value) |
| 643 | value, err := e.encodeValue(ctx, v, column) |
| 644 | if err != nil { |
| 645 | return nil, err |
| 646 | } |
| 647 | if e.isMapNode(value) { |
| 648 | value.AddColumn(e.indentNum) |
| 649 | } |
| 650 | if e.isTagAndMapNode(value) { |
| 651 | value.AddColumn(e.indentNum) |
| 652 | } |
| 653 | return ast.MappingValue( |
| 654 | token.New("", "", e.pos(column)), |
| 655 | e.encodeString(k.Interface().(string), column), |
| 656 | value, |
| 657 | ), nil |
| 658 | } |
| 659 | |
| 660 | func (e *Encoder) encodeMapSlice(ctx context.Context, value MapSlice, column int) (*ast.MappingNode, error) { |
| 661 | node := ast.Mapping(token.New("", "", e.pos(column)), e.isFlowStyle) |
no test coverage detected