mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-05 00:54:51 +08:00
fix: correct key order after add, flatten, keys, sort, reverse and shuffle
Signed-off-by: Antoine Deschênes <antoine.deschenes@linux.com>
This commit is contained in:
committed by
Mike Farah
parent
b84fd47934
commit
b15ce77cad
@@ -239,14 +239,13 @@ func (n *CandidateNode) AddKeyValueChild(rawKey *CandidateNode, rawValue *Candid
|
||||
func (n *CandidateNode) AddChild(rawChild *CandidateNode) {
|
||||
value := rawChild.Copy()
|
||||
value.SetParent(n)
|
||||
if value.Key != nil {
|
||||
value.Key.SetParent(n)
|
||||
} else {
|
||||
index := len(n.Content)
|
||||
keyNode := createScalarNode(index, fmt.Sprintf("%v", index))
|
||||
keyNode.SetParent(n)
|
||||
value.Key = keyNode
|
||||
}
|
||||
value.IsMapKey = false
|
||||
|
||||
index := len(n.Content)
|
||||
keyNode := createScalarNode(index, fmt.Sprintf("%v", index))
|
||||
keyNode.SetParent(n)
|
||||
value.Key = keyNode
|
||||
|
||||
n.Content = append(n.Content, value)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user