From c0909e91a5045e735b2718a92e1bfef59d39b04e Mon Sep 17 00:00:00 2001 From: Doug Fawley Date: Tue, 22 Oct 2019 13:01:54 -0700 Subject: [PATCH] resolver: move dns and passthrough to internal (#3116) Nobody should directly need to reference these packages. This is technically a breaking change. However: - Package dns was exporting a NewBuilder method. This should never have been necessary to use, but if so, it can be replaced by importing the "grpc" package and then using resolver.Get("dns"). - Package passthrough was not exporting any symbols and there was never a need to even blank-import it. After as much searching as possible, it appears nobody in the open source community is referencing either of these packages. --- balancer_test.go | 5 ----- clientconn.go | 7 ++++--- clientconn_test.go | 1 - {resolver => internal/resolver}/dns/dns_resolver.go | 0 {resolver => internal/resolver}/dns/dns_resolver_test.go | 0 {resolver => internal/resolver}/passthrough/passthrough.go | 0 test/end2end_test.go | 1 - vet.sh | 2 +- 8 files changed, 5 insertions(+), 11 deletions(-) rename {resolver => internal/resolver}/dns/dns_resolver.go (100%) rename {resolver => internal/resolver}/dns/dns_resolver_test.go (100%) rename {resolver => internal/resolver}/passthrough/passthrough.go (100%) diff --git a/balancer_test.go b/balancer_test.go index a494d6e87..77e937cb2 100644 --- a/balancer_test.go +++ b/balancer_test.go @@ -31,11 +31,6 @@ import ( _ "google.golang.org/grpc/grpclog/glogger" "google.golang.org/grpc/naming" "google.golang.org/grpc/status" - - // V1 balancer tests use passthrough resolver instead of dns. - // TODO(bar) remove this when removing v1 balaner entirely. - - _ "google.golang.org/grpc/resolver/passthrough" ) func pickFirstBalancerV1(r naming.Resolver) Balancer { diff --git a/clientconn.go b/clientconn.go index 463c7768e..4414ba87f 100644 --- a/clientconn.go +++ b/clientconn.go @@ -32,7 +32,6 @@ import ( "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/base" - _ "google.golang.org/grpc/balancer/roundrobin" // To register roundrobin. "google.golang.org/grpc/codes" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/credentials" @@ -43,10 +42,12 @@ import ( "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/resolver" - _ "google.golang.org/grpc/resolver/dns" // To register dns resolver. - _ "google.golang.org/grpc/resolver/passthrough" // To register passthrough resolver. "google.golang.org/grpc/serviceconfig" "google.golang.org/grpc/status" + + _ "google.golang.org/grpc/balancer/roundrobin" // To register roundrobin. + _ "google.golang.org/grpc/internal/resolver/dns" // To register dns resolver. + _ "google.golang.org/grpc/internal/resolver/passthrough" // To register passthrough resolver. ) const ( diff --git a/clientconn_test.go b/clientconn_test.go index 2b8b8176d..02d15abbc 100644 --- a/clientconn_test.go +++ b/clientconn_test.go @@ -39,7 +39,6 @@ import ( "google.golang.org/grpc/naming" "google.golang.org/grpc/resolver" "google.golang.org/grpc/resolver/manual" - _ "google.golang.org/grpc/resolver/passthrough" "google.golang.org/grpc/testdata" ) diff --git a/resolver/dns/dns_resolver.go b/internal/resolver/dns/dns_resolver.go similarity index 100% rename from resolver/dns/dns_resolver.go rename to internal/resolver/dns/dns_resolver.go diff --git a/resolver/dns/dns_resolver_test.go b/internal/resolver/dns/dns_resolver_test.go similarity index 100% rename from resolver/dns/dns_resolver_test.go rename to internal/resolver/dns/dns_resolver_test.go diff --git a/resolver/passthrough/passthrough.go b/internal/resolver/passthrough/passthrough.go similarity index 100% rename from resolver/passthrough/passthrough.go rename to internal/resolver/passthrough/passthrough.go diff --git a/test/end2end_test.go b/test/end2end_test.go index 3a450352f..cbd42120c 100644 --- a/test/end2end_test.go +++ b/test/end2end_test.go @@ -69,7 +69,6 @@ import ( "google.golang.org/grpc/peer" "google.golang.org/grpc/resolver" "google.golang.org/grpc/resolver/manual" - _ "google.golang.org/grpc/resolver/passthrough" "google.golang.org/grpc/serviceconfig" "google.golang.org/grpc/stats" "google.golang.org/grpc/status" diff --git a/vet.sh b/vet.sh index b2da74c00..2e7d37a2f 100755 --- a/vet.sh +++ b/vet.sh @@ -128,7 +128,7 @@ google.golang.org/grpc/examples/features/debugging/client/main.go:SA1019 google.golang.org/grpc/examples/features/load_balancing/client/main.go:SA1019 google.golang.org/grpc/internal/transport/handler_server.go:SA1019 google.golang.org/grpc/internal/transport/handler_server_test.go:SA1019 -google.golang.org/grpc/resolver/dns/dns_resolver.go:SA1019 +google.golang.org/grpc/internal/resolver/dns/dns_resolver.go:SA1019 google.golang.org/grpc/stats/stats_test.go:SA1019 google.golang.org/grpc/test/balancer_test.go:SA1019 google.golang.org/grpc/test/channelz_test.go:SA1019