1
0
mirror of https://github.com/go-task/task.git synced 2025-03-25 21:39:05 +02:00

feat: edge weight

This commit is contained in:
Pete Davison 2024-04-21 15:36:18 +00:00
parent f19c520f23
commit 53235f07ad

View File

@ -147,13 +147,16 @@ func (r *Reader) include(node Node) error {
node.Location(),
includeNode.Location(),
graph.EdgeData([]*ast.Include{include}),
graph.EdgeWeight(1),
)
} else {
// If the edge already exists
edgeData := append(edge.Properties.Data.([]*ast.Include), include)
err = r.graph.UpdateEdge(
node.Location(),
includeNode.Location(),
graph.EdgeData(append(edge.Properties.Data.([]*ast.Include), include)),
graph.EdgeData(edgeData),
graph.EdgeWeight(len(edgeData)),
)
}
if errors.Is(err, graph.ErrEdgeCreatesCycle) {