From cd13f0389fb82962b672adfc20f7f5916a2a439f Mon Sep 17 00:00:00 2001
From: Asim <asim@chuhnk.me>
Date: Tue, 26 Jan 2016 20:44:29 +0000
Subject: [PATCH] Fix this cruft

---
 registry/consul_registry.go | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/registry/consul_registry.go b/registry/consul_registry.go
index 6511db00..843f2281 100644
--- a/registry/consul_registry.go
+++ b/registry/consul_registry.go
@@ -7,7 +7,6 @@ import (
 	"fmt"
 	"net"
 	"net/http"
-	"os"
 	"runtime"
 	"time"
 
@@ -159,7 +158,15 @@ func (c *consulRegistry) Deregister(s *Service) error {
 	if len(s.Nodes) == 0 {
 		return errors.New("Require at least one node")
 	}
-	return c.Client.Agent().ServiceDeregister(s.Nodes[0].Id)
+
+	node := s.Nodes[0]
+
+	_, err := c.Client.Catalog().Deregister(&consul.CatalogDeregistration{
+		Node:      node.Id,
+		Address:   node.Address,
+		ServiceID: node.Id,
+	}, nil)
+	return err
 }
 
 func (c *consulRegistry) Register(s *Service) error {