Short circuit anno/label transformer for performance.

This commit is contained in:
monopole
2021-01-08 17:44:08 -08:00
parent 6f2f401f6b
commit 769f65d6c4
7 changed files with 54 additions and 34 deletions

View File

@@ -648,9 +648,15 @@ func (s FieldSetter) Filter(rn *RNode) (*RNode, error) {
}
// create the field
rn.YNode().Content = append(rn.YNode().Content,
&yaml.Node{Kind: yaml.ScalarNode, HeadComment: s.Comments.HeadComment,
LineComment: s.Comments.LineComment, FootComment: s.Comments.FootComment, Value: s.Name},
rn.YNode().Content = append(
rn.YNode().Content,
&yaml.Node{
Kind: yaml.ScalarNode,
Value: s.Name,
HeadComment: s.Comments.HeadComment,
LineComment: s.Comments.LineComment,
FootComment: s.Comments.FootComment,
},
s.Value.YNode())
return s.Value, nil
}