diff --git a/depgraph/graph.go b/depgraph/graph.go index acca4ce6c..62b39572f 100644 --- a/depgraph/graph.go +++ b/depgraph/graph.go @@ -232,6 +232,15 @@ CHECK_CYCLES: } } + // Check for loops to yourself + for _, n := range g.Nouns { + for _, d := range n.Deps { + if d.Source == d.Target { + vErr.Cycles = append(vErr.Cycles, []*Noun{n}) + } + } + } + // Return the detailed error if vErr.MissingRoot || vErr.Unreachable != nil || vErr.Cycles != nil { return vErr