1
0
mirror of https://github.com/go-task/task.git synced 2025-08-10 22:42:19 +02:00

Fix nil errors when merging Taskfiles

Closes #150
This commit is contained in:
Andrey Nering
2018-12-02 14:17:32 -02:00
parent 4ed4ad9852
commit a9b1f38a7c
5 changed files with 39 additions and 0 deletions

View File

@@ -20,12 +20,24 @@ func Merge(t1, t2 *Taskfile, namespaces ...string) error {
if t2.Output != "" {
t1.Output = t2.Output
}
if t1.Includes == nil {
t1.Includes = make(map[string]string)
}
for k, v := range t2.Includes {
t1.Includes[k] = v
}
if t1.Vars == nil {
t1.Vars = make(Vars)
}
for k, v := range t2.Vars {
t1.Vars[k] = v
}
if t1.Tasks == nil {
t1.Tasks = make(Tasks)
}
for k, v := range t2.Tasks {
t1.Tasks[taskNameWithNamespace(k, namespaces...)] = v
}