@@ -218,15 +218,18 @@ } } // Returns a handler that stores every seen task and an ancillary function to retrieve those func collecting() (handler, func() tasks) { - var seen = make(map[*task]struct{}) + var seen = make(map[*task]bool) return func(t *task) action { - seen[t] = struct{}{} - for _, dep := range t.depends { - seen[dep] = struct{}{} + depth := tasks{t} + for i := 0; i < len(depth); i++ { + if !seen[depth[i]] { + seen[depth[i]] = true + depth = append(depth, depth[i].depends...) + } } return action{} }, func() tasks { seq := make(tasks, 0, len(seen)) for k, _ := range seen {