From 58775249c5e4ecd8f6fecb5a9643e3c5d1d46fe2 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Thu, 9 May 2019 23:01:58 +0300 Subject: [PATCH] fix race with rcache Signed-off-by: Vasiliy Tolstov --- registry/gossip/watcher.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/registry/gossip/watcher.go b/registry/gossip/watcher.go index a43d875e..57b35521 100644 --- a/registry/gossip/watcher.go +++ b/registry/gossip/watcher.go @@ -34,7 +34,9 @@ func (m *gossipWatcher) Next() (*registry.Result, error) { if len(m.wo.Service) > 0 && r.Service.Name != m.wo.Service { continue } - return r, nil + nr := ®istry.Result{} + *nr = *r + return nr, nil case <-m.stop: return nil, registry.ErrWatcherStopped }