diff --git a/consul/catalog_endpoint.go b/consul/catalog_endpoint.go index 5b5a47539d..96100b1efb 100644 --- a/consul/catalog_endpoint.go +++ b/consul/catalog_endpoint.go @@ -76,8 +76,8 @@ func (c *Catalog) ListNodes(dc string, reply *structs.Nodes) error { // Format the response nodes := structs.Nodes(make([]structs.Node, len(rawNodes)/2)) - for i := 0; i < len(rawNodes); i += 2 { - nodes[i] = structs.Node{rawNodes[i], rawNodes[i+1]} + for i := 0; i < len(nodes); i++ { + nodes[i] = structs.Node{rawNodes[i*2], rawNodes[i*2+1]} } *reply = nodes