216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
|
}
return action{stop: true}
}
}
// 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{})
return func(t *task) action {
seen[t] = struct{}{}
for _, dep := range t.depends {
seen[dep] = struct{}{}
}
return action{}
}, func() tasks {
seq := make(tasks, 0, len(seen))
for k, _ := range seen {
seq = append(seq, k)
}
|
|
>
>
|
<
|
>
>
|
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
}
return action{stop: true}
}
}
// 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]bool)
return func(t *task) action {
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 {
seq = append(seq, k)
}
|