"sort"
"strings"
+ "github.com/hashicorp/terraform/tfdiags"
+
"github.com/hashicorp/go-multierror"
)
}
// WalkFunc is the callback used for walking the graph.
-type WalkFunc func(Vertex) error
+type WalkFunc func(Vertex) tfdiags.Diagnostics
// DepthWalkFunc is a walk function that also receives the current depth of the
// walk as an argument
}
// Walk walks the graph, calling your callback as each node is visited.
-// This will walk nodes in parallel if it can. Because the walk is done
-// in parallel, the error returned will be a multierror.
-func (g *AcyclicGraph) Walk(cb WalkFunc) error {
+// This will walk nodes in parallel if it can. The resulting diagnostics
+// contains problems from all graphs visited, in no particular order.
+func (g *AcyclicGraph) Walk(cb WalkFunc) tfdiags.Diagnostics {
defer g.debug.BeginOperation(typeWalk, "").End("")
w := &Walker{Callback: cb, Reverse: true}