コード例 #1
0
ファイル: somepath.go プロジェクト: thought-machine/please
// 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
}