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

fix: advanced import operates on including file instead of included file

This commit is contained in:
Pete Davison
2024-03-19 15:02:32 +00:00
parent 8f3180a9fa
commit e9448bd4be
6 changed files with 26 additions and 37 deletions

View File

@@ -45,11 +45,17 @@ func (vs *Vars) Range(f func(k string, v Var) error) error {
}
// Wrapper around OrderedMap.Merge to ensure we don't get nil pointer errors
func (vs *Vars) Merge(other *Vars) {
func (vs *Vars) Merge(other *Vars, include *Include) {
if vs == nil || other == nil {
return
}
vs.OrderedMap.Merge(other.OrderedMap)
other.Range(func(key string, value Var) error {
if include != nil && include.AdvancedImport {
value.Dir = include.Dir
}
vs.Set(key, value)
return nil
})
}
// Wrapper around OrderedMap.Len to ensure we don't get nil pointer errors