-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
Reproduction based on the original usage example, but modifying the exit criteria:
package main
import (
"fmt"
"github.com/heimdalr/dag"
)
func main() {
dag := dag.NewDAG()
v1, _ := dag.AddVertex("1")
v2, _ := dag.AddVertex("2")
v3, _ := dag.AddVertex("3")
v4, _ := dag.AddVertex("4")
v5, _ := dag.AddVertex("5")
_ = dag.AddEdge(v1, v2)
_ = dag.AddEdge(v2, v3)
_ = dag.AddEdge(v2, v4)
_ = dag.AddEdge(v4, v5)
var ancestors []interface{}
vertices, signal, _ := dag.AncestorsWalker(v5)
for v := range vertices {
ancestors = append(ancestors, v)
// v2 was modified to v1
if v == v1 {
signal <- true
break
}
}
fmt.Printf("%v", ancestors)
}
Results in
panic: send on closed channel
I'm happy to contribute, but I'm not quite sure how to resolve this while maintaining the current API contract.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels