Rearrange comments for yaml/V3 bug fix

This commit is contained in:
Phani Teja Marupaka
2020-03-30 01:00:49 -07:00
parent 50cc1968e4
commit 17503ae9d8
5 changed files with 92 additions and 7 deletions

View File

@@ -45,6 +45,7 @@ type ByteWriter struct {
var _ Writer = ByteWriter{}
func (w ByteWriter) Write(nodes []*yaml.RNode) error {
yaml.DoSerializationHacksOnNodes(nodes)
if w.Sort {
if err := kioutil.SortNodes(nodes); err != nil {
return errors.Wrap(err)
@@ -117,5 +118,7 @@ func (w ByteWriter) Write(nodes []*yaml.RNode) error {
for i := range nodes {
items.Content = append(items.Content, nodes[i].YNode())
}
return errors.Wrap(encoder.Encode(doc))
err := errors.Wrap(encoder.Encode(doc))
yaml.UndoSerializationHacksOnNodes(nodes)
return err
}