From df074a54e37f65db49b9489b3b0a2a58f74fbf7e Mon Sep 17 00:00:00 2001 From: Diptanu Choudhury Date: Wed, 18 Nov 2015 01:20:53 -0800 Subject: [PATCH] DRYed the code --- client/consul.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/client/consul.go b/client/consul.go index 27ea17735..a7f411941 100644 --- a/client/consul.go +++ b/client/consul.go @@ -68,15 +68,10 @@ func (c *ConsulClient) DeRegister(task *structs.Task) error { } func (c *ConsulClient) findPortAndHostForLabel(portLabel string, task *structs.Task) (string, int) { - var host string - var port int for _, network := range task.Resources.Networks { if p, ok := network.MapLabelToValues()[portLabel]; ok { - host = network.IP - port = p - break + return network.IP, p } } - - return host, port + return "", 0 }