etcd-example icon indicating copy to clipboard operation
etcd-example copied to clipboard

the ETCD service discovery could not be run as readme described

Open SmartsYoung opened this issue 4 years ago • 3 comments

In function (s *ServiceDiscovery) WatchService(prefix string) error , the sentence resp, err := s.cli.Get(context.Background(), prefix, clientv3.WithPrefix()) there is no any result return. And run the discovery.go and the register.go there is nothing to show in the terminal. Could you please test it, thanks!

SmartsYoung avatar Jun 02 '20 07:06 SmartsYoung

@SmartsYoung Please make sure the ETCD is running.

Bingjian-Zhu avatar Jun 02 '20 07:06 Bingjian-Zhu

Thanks, It's ok! But in the discovery.go, the function (s *ServiceDiscovery) GetServices() []string define the addrs := make([]string, 0, len(serverList)) may lead to fix as the serverList not a global var.

SmartsYoung avatar Jun 02 '20 08:06 SmartsYoung

@SmartsYoung Yes, Thanks!

Bingjian-Zhu avatar Jun 02 '20 08:06 Bingjian-Zhu