// This is just a simple DFS through the graph. func printSomePath(graph *core.BuildGraph, target1, target2 *core.BuildTarget) bool { if target1 == target2 { fmt.Printf("Found path:\n %s\n", target1.Label) return true } for _, target := range graph.ReverseDependencies(target2) { if printSomePath(graph, target1, target) { if target2.Parent(graph) != target { fmt.Printf(" %s\n", target2.Label) } return true } } return false }