We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 04e7449 commit 9fab280Copy full SHA for 9fab280
graph/graph.go
@@ -155,11 +155,18 @@ func (g *Graph) Remove(plugin any) []*Vertex {
155
156
// remove all edges where dest is our plugin prepared to delete
157
for _, v := range g.vertices {
158
+ // since we are deleting while iterating, we need to create a new slice
159
+ // to prevent index out of range or similar errors
160
+ newEdges := make([]*edge, 0, len(v.edges))
161
for i := range v.edges {
162
if v.edges[i].dest == plugin {
- v.edges = slices.Delete(v.edges, i, i+1)
163
+ // we found an edge which is pointing to our plugin,
164
+ // we need to remove it for the graph
165
+ continue
166
}
167
+ newEdges = append(newEdges, v.edges[i])
168
169
+ v.edges = newEdges
170
171
172
for i := range g.topologicalOrder {
0 commit comments