Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

fix(intrinsics): continue to process children when transforming #599

Merged
merged 1 commit into from
Jun 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions intrinsics/tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,20 @@ func addTagResolver(tag string, resolver func(*yaml.Node) (*yaml.Node, error)) {
}

func resolveTags(node *yaml.Node) (*yaml.Node, error) {
var err error

for tag, fn := range tagResolvers {
// Transform the node if it has the tag
// But keep processing the children
if node.Tag == tag {
return fn(node)
node, err = fn(node)
if err != nil {
return nil, err
}
}
}

if node.Kind == yaml.SequenceNode || node.Kind == yaml.MappingNode {
var err error
for i := range node.Content {
node.Content[i], err = resolveTags(node.Content[i])
if err != nil {
Expand Down