mirror of
https://github.com/go-task/task.git
synced 2025-07-13 01:30:33 +02:00
@ -13,7 +13,12 @@ func (e *Executor) CheckCyclicDep() error {
|
|||||||
defer delete(visits, name)
|
defer delete(visits, name)
|
||||||
|
|
||||||
for _, d := range t.Deps {
|
for _, d := range t.Deps {
|
||||||
if err := checkCyclicDep(d.Task, e.Tasks[d.Task]); err != nil {
|
// FIXME: ignoring by now. should return an error instead?
|
||||||
|
task, ok := e.Tasks[d.Task]
|
||||||
|
if !ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if err := checkCyclicDep(d.Task, task); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,4 +35,22 @@ func TestCyclicDepCheck(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert.NoError(t, isNotCyclic.CheckCyclicDep())
|
assert.NoError(t, isNotCyclic.CheckCyclicDep())
|
||||||
|
|
||||||
|
inexixtentTask := &task.Executor{
|
||||||
|
Tasks: task.Tasks{
|
||||||
|
"task-a": &task.Task{
|
||||||
|
Deps: []*task.Dep{&task.Dep{Task: "invalid-task"}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME: by now Task should ignore non existent tasks
|
||||||
|
// in the future we should improve the detection of
|
||||||
|
// tasks called with interpolation?
|
||||||
|
// task:
|
||||||
|
// deps:
|
||||||
|
// - task: "task{{.VARIABLE}}"
|
||||||
|
// vars:
|
||||||
|
// VARIABLE: something
|
||||||
|
assert.NoError(t, inexixtentTask.CheckCyclicDep())
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user