1
0
mirror of https://github.com/go-task/task.git synced 2025-11-06 09:09:13 +02:00

Fix issue on running dependencies or tasks on included Taskfiles

Fixes #151
This commit is contained in:
Andrey Nering
2018-12-09 15:54:58 -02:00
parent a9b1f38a7c
commit 95b75c5330
5 changed files with 53 additions and 0 deletions

View File

@@ -39,7 +39,20 @@ func Merge(t1, t2 *Taskfile, namespaces ...string) error {
t1.Tasks = make(Tasks)
}
for k, v := range t2.Tasks {
// FIXME(@andreynering): Refactor this block, otherwise we can
// have serious side-effects in the future, since we're editing
// the original references instead of deep copying them.
t1.Tasks[taskNameWithNamespace(k, namespaces...)] = v
for _, dep := range v.Deps {
dep.Task = taskNameWithNamespace(dep.Task, namespaces...)
}
for _, cmd := range v.Cmds {
if cmd.Task != "" {
cmd.Task = taskNameWithNamespace(cmd.Task, namespaces...)
}
}
}
return nil