From aed016e7bef4cd0be8017ac7c5d91549833cf492 Mon Sep 17 00:00:00 2001 From: "suguo.yao" Date: Fri, 8 Oct 2021 13:24:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4consul=E5=8F=96=E5=BE=AE?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E6=94=AF=E6=8C=81tag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- consul/consul.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/consul/consul.go b/consul/consul.go index d8bf42f..615d37e 100644 --- a/consul/consul.go +++ b/consul/consul.go @@ -123,9 +123,9 @@ func FindNode(servicename, tag string) (*consulapi.AgentService, error) { return services[r.Intn(l)%l].Service, nil } -//FindServer 从consul中发现服务,并返回grpc连接实例 -func FindServer(servicename string) (*grpc.ClientConn, error) { - node, err := FindNode(servicename, "") //无tag视为grpc服务 +//FindService 从consul中发现服务,并返回grpc连接实例 +func FindService(servicename, tag string) (*grpc.ClientConn, error) { + node, err := FindNode(servicename, tag) //无tag视为grpc服务 if err != nil { return nil, err }