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:
Sean Chittenden 2016-03-25 13:08:08 -07:00
parent 9c18bb5f1c
commit d9251e30c8
1 changed files with 1 additions and 2 deletions

View File

@ -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]...)