mirror of
https://github.com/go-task/task.git
synced 2024-12-12 10:45:49 +02:00
parent
06031efc09
commit
ac48ee066e
@ -13,7 +13,12 @@ func (e *Executor) CheckCyclicDep() error {
|
||||
defer delete(visits, name)
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -35,4 +35,22 @@ func TestCyclicDepCheck(t *testing.T) {
|
||||
}
|
||||
|
||||
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())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user