File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ package loader
19
19
import (
20
20
"fmt"
21
21
"strconv"
22
+ "strings"
22
23
23
24
"github.com/compose-spec/compose-go/v2/tree"
24
25
"gopkg.in/yaml.v3"
@@ -40,6 +41,21 @@ func (p *ResetProcessor) UnmarshalYAML(value *yaml.Node) error {
40
41
41
42
// resolveReset detects `!reset` tag being set on yaml nodes and record position in the yaml tree
42
43
func (p * ResetProcessor ) resolveReset (node * yaml.Node , path tree.Path ) (* yaml.Node , error ) {
44
+ // If the path contains "<<", removing the "<<" element and merging the path
45
+ if strings .Contains (path .String (), "<<" ) {
46
+ pathArr := strings .Split (path .String (), "." )
47
+ path = tree .NewPath (pathArr [0 ])
48
+ for _ , el := range pathArr [1 :] {
49
+ if el != "<<" {
50
+ path = tree .Path (strings .Join ([]string {path .String (), el }, "." ))
51
+ }
52
+ }
53
+ }
54
+ // If the node is an alias, We need to process the alias field in order to consider the !override and !reset tags
55
+ if node .Kind == yaml .AliasNode {
56
+ return p .resolveReset (node .Alias , path )
57
+ }
58
+
43
59
if node .Tag == "!reset" {
44
60
p .paths = append (p .paths , path )
45
61
return nil , nil
You can’t perform that action at this time.
0 commit comments