copyNodeShallow copies type/tag/value and resets content to match src, but keeps the same destination node pointer to preserve parent relations/comments.
(dst, src *yaml.Node)
| 1632 | // copyNodeShallow copies type/tag/value and resets content to match src, but |
| 1633 | // keeps the same destination node pointer to preserve parent relations/comments. |
| 1634 | func copyNodeShallow(dst, src *yaml.Node) { |
| 1635 | if dst == nil || src == nil { |
| 1636 | return |
| 1637 | } |
| 1638 | dst.Kind = src.Kind |
| 1639 | dst.Tag = src.Tag |
| 1640 | dst.Value = src.Value |
| 1641 | // Replace content with deep copy from src |
| 1642 | if len(src.Content) > 0 { |
| 1643 | dst.Content = make([]*yaml.Node, len(src.Content)) |
| 1644 | for i := range src.Content { |
| 1645 | dst.Content[i] = deepCopyNode(src.Content[i]) |
| 1646 | } |
| 1647 | } else { |
| 1648 | dst.Content = nil |
| 1649 | } |
| 1650 | } |
| 1651 | |
| 1652 | func reorderSequenceForMerge(dst, src *yaml.Node) { |
| 1653 | if dst == nil || src == nil { |
no test coverage detected