mirror of https://github.com/status-im/consul.git
Use range vs for
Returning a new array vs mutating an array in place so we can use range now.
This commit is contained in:
parent
9c18bb5f1c
commit
d9251e30c8
|
@ -260,8 +260,7 @@ func (sm *ServerManager) RemoveServer(server *server_details.ServerDetails) {
|
||||||
serverCfg := sm.getServerConfig()
|
serverCfg := sm.getServerConfig()
|
||||||
|
|
||||||
// Remove the server if known
|
// Remove the server if known
|
||||||
n := len(serverCfg.servers)
|
for i, _ := range serverCfg.servers {
|
||||||
for i := 0; i < n; i++ {
|
|
||||||
if serverCfg.servers[i].Name == server.Name {
|
if serverCfg.servers[i].Name == server.Name {
|
||||||
newServers := make([]*server_details.ServerDetails, 0, len(serverCfg.servers)-1)
|
newServers := make([]*server_details.ServerDetails, 0, len(serverCfg.servers)-1)
|
||||||
newServers = append(newServers, serverCfg.servers[:i]...)
|
newServers = append(newServers, serverCfg.servers[:i]...)
|
||||||
|
|
Loading…
Reference in New Issue