mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 18:25:26 +00:00
Merge pull request #5155 from ephesused/eliminate-unnecessary-rnode
perf: eliminate unnecessary RNode creation
This commit is contained in:
@@ -450,15 +450,13 @@ func (rn *RNode) getMetaData() *yaml.Node {
|
|||||||
if IsMissingOrNull(rn) {
|
if IsMissingOrNull(rn) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
var n *RNode
|
content := rn.Content()
|
||||||
if rn.YNode().Kind == DocumentNode {
|
if rn.YNode().Kind == DocumentNode {
|
||||||
// get the content if this is the document node
|
// get the content if this is the document node
|
||||||
n = NewRNode(rn.Content()[0])
|
content = content[0].Content
|
||||||
} else {
|
|
||||||
n = rn
|
|
||||||
}
|
}
|
||||||
var mf *yaml.Node
|
var mf *yaml.Node
|
||||||
visitMappingNodeFields(n.Content(), func(key, value *yaml.Node) {
|
visitMappingNodeFields(content, func(key, value *yaml.Node) {
|
||||||
if !IsYNodeNilOrEmpty(value) {
|
if !IsYNodeNilOrEmpty(value) {
|
||||||
mf = value
|
mf = value
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user