func addAddress(servers []network.MachineHostPorts, addr string) ([]network.MachineHostPorts, error) {
	for i, server := range servers {
		for j, hostPort := range server {
			if network.DialAddress(hostPort) == addr {
				slideAddressToFront(servers, i, j)
				return servers, nil
			}
		}
	}
	host, portString, err := net.SplitHostPort(addr)
	if err != nil {
		return nil, err
	}
	port, err := strconv.Atoi(portString)
	if err != nil {
		return nil, err
	}
	result := make([]network.MachineHostPorts, 0, len(servers)+1)
	result = append(result, network.NewMachineHostPorts(port, host))
	result = append(result, servers...)
	return result, nil
}
// addAddress appends a new server derived from the given
// address to servers if the address is not already found
// there.
addAddress appends a new server derived from the given
address to servers if the address is not already found
there.
// addAddress appends a new server derived from the given // address to servers if the address is not already found // there .
func addAddress(servers []network.MachineHostPorts, addr string) ([]network.MachineHostPorts, error) {
	for i, server := range servers {
		for j, hostPort := range server {
			if network.DialAddress(hostPort) == addr {
				slideAddressToFront(servers, i, j)
				return servers, nil
			}
		}
	}
	host, portString, err := net.SplitHostPort(addr)
	if err != nil {
		return nil, err
	}
	port, err := strconv.Atoi(portString)
	if err != nil {
		return nil, err
	}
	result := make([]network.MachineHostPorts, 0, len(servers)+1)
	result = append(result, network.NewMachineHostPorts(port, host))
	result = append(result, servers...)
	return result, nil
}
func addAddress ( servers [ ] network . MachineHostPorts , addr string ) ( [ ] network . MachineHostPorts , error ) { for i , server := range servers { for j , hostPort := range server { if network . DialAddress ( hostPort ) == addr { slideAddressToFront ( servers , i , j ) return servers , nil } } } host , portString , err := net . SplitHostPort ( addr ) if err != nil { return nil , err } port , err := strconv . Atoi ( portString ) if err != nil { return nil , err } result := make ( [ ] network . MachineHostPorts , 0 , len ( servers ) + 1 ) result = append ( result , network . NewMachineHostPorts ( port , host ) ) result = append ( result , servers ... ) return result , nil }
addAddress appends a new server derived from the given
address to servers if the address is not already found
there.
addAddress appends a new server derived from the given address to servers if the address is not already found there .