diff --git a/taskfile/ast/graph.go b/taskfile/ast/graph.go index 68f06f93..03e5c672 100644 --- a/taskfile/ast/graph.go +++ b/taskfile/ast/graph.go @@ -79,7 +79,7 @@ func (tfg *TaskfileGraph) Merge() (*Taskfile, error) { } // Get the merge options - include, ok := edge.Properties.Data.(Include) + include, ok := edge.Properties.Data.(*Include) if !ok { return fmt.Errorf("task: Failed to get merge options") } @@ -87,7 +87,7 @@ func (tfg *TaskfileGraph) Merge() (*Taskfile, error) { // Merge the included Taskfile into the parent Taskfile if err := vertex.Taskfile.Merge( includedVertex.Taskfile, - &include, + include, ); err != nil { return err } diff --git a/taskfile/ast/include.go b/taskfile/ast/include.go index 2d999649..5b04bc27 100644 --- a/taskfile/ast/include.go +++ b/taskfile/ast/include.go @@ -22,7 +22,7 @@ type Include struct { // Includes represents information about included tasksfiles type Includes struct { - omap.OrderedMap[string, Include] + omap.OrderedMap[string, *Include] } // UnmarshalYAML implements the yaml.Unmarshaler interface. @@ -41,7 +41,7 @@ func (includes *Includes) UnmarshalYAML(node *yaml.Node) error { return err } v.Namespace = keyNode.Value - includes.Set(keyNode.Value, v) + includes.Set(keyNode.Value, &v) } return nil } @@ -58,7 +58,7 @@ func (includes *Includes) Len() int { } // Wrapper around OrderedMap.Set to ensure we don't get nil pointer errors -func (includes *Includes) Range(f func(k string, v Include) error) error { +func (includes *Includes) Range(f func(k string, v *Include) error) error { if includes == nil { return nil } diff --git a/taskfile/reader.go b/taskfile/reader.go index e9fa8b61..bb00590d 100644 --- a/taskfile/reader.go +++ b/taskfile/reader.go @@ -96,11 +96,11 @@ func (r *Reader) include(node Node) error { var g errgroup.Group // Loop over each included taskfile - _ = vertex.Taskfile.Includes.Range(func(namespace string, include ast.Include) error { + _ = vertex.Taskfile.Includes.Range(func(namespace string, include *ast.Include) error { // Start a goroutine to process each included Taskfile g.Go(func() error { cache := &templater.Cache{Vars: vertex.Taskfile.Vars} - include = ast.Include{ + include = &ast.Include{ Namespace: include.Namespace, Taskfile: templater.Replace(include.Taskfile, cache), Dir: templater.Replace(include.Dir, cache),