From 4a71cf9ab857160b20bf0654194dbfdf2a52e7c2 Mon Sep 17 00:00:00 2001 From: Knut Zuidema Date: Tue, 19 Sep 2023 06:26:44 +0200 Subject: [PATCH] fix: remove usage of deprecated Type attribute of resolver.Address The type attribute has been removed in more recent versions of gRPC. The usage here is not required and the may be removed. See: https://github.com/grpc/grpc-go/pull/6451 --- builder.go | 1 - builder_test.go | 7 +++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/builder.go b/builder.go index 7465898..da259af 100644 --- a/builder.go +++ b/builder.go @@ -232,7 +232,6 @@ func (k *kResolver) makeAddresses(e Endpoints) ([]resolver.Address, string) { for _, address := range subset.Addresses { newAddrs = append(newAddrs, resolver.Address{ - Type: resolver.Backend, Addr: net.JoinHostPort(address.IP, port), ServerName: fmt.Sprintf("%s.%s", k.target.serviceName, k.target.serviceNamespace), Metadata: nil, diff --git a/builder_test.go b/builder_test.go index c5a2504..776a718 100644 --- a/builder_test.go +++ b/builder_test.go @@ -41,7 +41,6 @@ func (fc *fakeConn) NewAddress(addresses []resolver.Address) { fc.found = append(fc.found, a.Addr) fmt.Printf("%d, address: %s\n", i, a.Addr) fmt.Printf("%d, servername: %s\n", i, a.ServerName) - fmt.Printf("%d, type: %+v\n", i, a.Type) } fc.cmp <- struct{}{} } @@ -63,9 +62,9 @@ func TestBuilder(t *testing.T) { if len(fc.found) == 0 { t.Fatal("could not found endpoints") } -// fmt.Printf("ResolveNow \n") -// rs.ResolveNow(resolver.ResolveNowOptions{}) -// <-fc.cmp + // fmt.Printf("ResolveNow \n") + // rs.ResolveNow(resolver.ResolveNowOptions{}) + // <-fc.cmp }