1
0
mirror of https://github.com/go-task/task.git synced 2025-11-25 22:32:55 +02:00

fix: deep copy included tasks

This commit is contained in:
Pete Davison
2022-10-02 05:45:27 +00:00
parent bb79fa1dc3
commit d33906b6e4
5 changed files with 89 additions and 10 deletions

View File

@@ -120,6 +120,23 @@ func (it *IncludedTaskfile) UnmarshalYAML(unmarshal func(interface{}) error) err
return nil
}
// DeepCopy creates a new instance of IncludedTaskfile and copies
// data by value from the source struct.
func (it *IncludedTaskfile) DeepCopy() *IncludedTaskfile {
if it == nil {
return nil
}
return &IncludedTaskfile{
Taskfile: it.Taskfile,
Dir: it.Dir,
Optional: it.Optional,
Internal: it.Internal,
AdvancedImport: it.AdvancedImport,
Vars: it.Vars.DeepCopy(),
BaseDir: it.BaseDir,
}
}
// FullTaskfilePath returns the fully qualified path to the included taskfile
func (it *IncludedTaskfile) FullTaskfilePath() (string, error) {
return it.resolvePath(it.Taskfile)