Don't preallocate the slice if you don't index later on.

This commit is contained in:
Milos Gajdos 2019-09-03 15:02:30 +01:00
parent b50c44a758
commit 3ea4490d6c
No known key found for this signature in database
GPG Key ID: 8B31058CC55DFD4F

View File

@ -812,7 +812,7 @@ func (n *network) Nodes() []Node {
}
}
nodes := make([]Node, len(visited))
var nodes []Node
// collect all the nodes and return them
for _, node := range visited {
nodes = append(nodes, node)