1
0
mirror of https://github.com/go-task/task.git synced 2025-11-27 22:38:20 +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

@@ -34,6 +34,18 @@ func (vs *Vars) UnmarshalYAML(node *yaml.Node) error {
return nil
}
// DeepCopy creates a new instance of Vars and copies
// data by value from the source struct.
func (vs *Vars) DeepCopy() *Vars {
if vs == nil {
return nil
}
return &Vars{
Keys: deepCopySlice(vs.Keys),
Mapping: deepCopyMap(vs.Mapping),
}
}
// Merge merges the given Vars into the caller one
func (vs *Vars) Merge(other *Vars) {
_ = other.Range(func(key string, value Var) error {