From 727a60e4d135c53c4d62d708ac4528f7c077c0d0 Mon Sep 17 00:00:00 2001 From: Mak Mukhi Date: Fri, 21 Oct 2016 18:06:55 -0700 Subject: [PATCH 1/3] update server reflection code to comply with the change to the grpc generator --- benchmark/grpc_testing/services.pb.go | 2 +- examples/helloworld/helloworld/helloworld.pb.go | 2 +- examples/route_guide/routeguide/route_guide.pb.go | 2 +- grpclb/grpc_lb_v1/grpclb.pb.go | 2 +- health/grpc_health_v1/health.pb.go | 2 +- interop/grpc_testing/test.pb.go | 2 +- reflection/grpc_reflection_v1alpha/reflection.pb.go | 2 +- reflection/grpc_testing/test.pb.go | 2 +- reflection/serverreflection.go | 3 ++- rpc_util.go | 4 ++-- stress/grpc_testing/metrics.pb.go | 2 +- test/grpc_testing/test.pb.go | 2 +- 12 files changed, 14 insertions(+), 13 deletions(-) diff --git a/benchmark/grpc_testing/services.pb.go b/benchmark/grpc_testing/services.pb.go index 15d08644..8afe4a8d 100644 --- a/benchmark/grpc_testing/services.pb.go +++ b/benchmark/grpc_testing/services.pb.go @@ -24,7 +24,7 @@ var _ grpc.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion3 +const _ = grpc.SupportPackageIsVersion4 // Client API for BenchmarkService service diff --git a/examples/helloworld/helloworld/helloworld.pb.go b/examples/helloworld/helloworld/helloworld.pb.go index 0419f6af..f7b4502b 100644 --- a/examples/helloworld/helloworld/helloworld.pb.go +++ b/examples/helloworld/helloworld/helloworld.pb.go @@ -65,7 +65,7 @@ var _ grpc.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion3 +const _ = grpc.SupportPackageIsVersion4 // Client API for Greeter service diff --git a/examples/route_guide/routeguide/route_guide.pb.go b/examples/route_guide/routeguide/route_guide.pb.go index 9bb1d605..b7afbf5b 100644 --- a/examples/route_guide/routeguide/route_guide.pb.go +++ b/examples/route_guide/routeguide/route_guide.pb.go @@ -156,7 +156,7 @@ var _ grpc.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion3 +const _ = grpc.SupportPackageIsVersion4 // Client API for RouteGuide service diff --git a/grpclb/grpc_lb_v1/grpclb.pb.go b/grpclb/grpc_lb_v1/grpclb.pb.go index da371e52..5c8b595f 100644 --- a/grpclb/grpc_lb_v1/grpclb.pb.go +++ b/grpclb/grpc_lb_v1/grpclb.pb.go @@ -420,7 +420,7 @@ var _ grpc.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion3 +const _ = grpc.SupportPackageIsVersion4 // Client API for LoadBalancer service diff --git a/health/grpc_health_v1/health.pb.go b/health/grpc_health_v1/health.pb.go index 0e6a9100..4bb91cc1 100644 --- a/health/grpc_health_v1/health.pb.go +++ b/health/grpc_health_v1/health.pb.go @@ -90,7 +90,7 @@ var _ grpc.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion3 +const _ = grpc.SupportPackageIsVersion4 // Client API for Health service diff --git a/interop/grpc_testing/test.pb.go b/interop/grpc_testing/test.pb.go index 54ead93b..9af329c2 100755 --- a/interop/grpc_testing/test.pb.go +++ b/interop/grpc_testing/test.pb.go @@ -407,7 +407,7 @@ var _ grpc.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion3 +const _ = grpc.SupportPackageIsVersion4 // Client API for TestService service diff --git a/reflection/grpc_reflection_v1alpha/reflection.pb.go b/reflection/grpc_reflection_v1alpha/reflection.pb.go index da90479e..68670306 100644 --- a/reflection/grpc_reflection_v1alpha/reflection.pb.go +++ b/reflection/grpc_reflection_v1alpha/reflection.pb.go @@ -544,7 +544,7 @@ var _ grpc.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion3 +const _ = grpc.SupportPackageIsVersion4 // Client API for ServerReflection service diff --git a/reflection/grpc_testing/test.pb.go b/reflection/grpc_testing/test.pb.go index add7abd0..6dbea30d 100644 --- a/reflection/grpc_testing/test.pb.go +++ b/reflection/grpc_testing/test.pb.go @@ -66,7 +66,7 @@ var _ grpc.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion3 +const _ = grpc.SupportPackageIsVersion4 // Client API for SearchService service diff --git a/reflection/serverreflection.go b/reflection/serverreflection.go index 686090aa..4b3fcf5f 100644 --- a/reflection/serverreflection.go +++ b/reflection/serverreflection.go @@ -251,11 +251,12 @@ func (s *serverReflectionServer) fileDescEncodingContainingSymbol(name string) ( } // Metadata not valid. - enc, ok := meta.([]byte) + fileNameForMeta, ok := meta.(string) if !ok { return nil, fmt.Errorf("invalid file descriptor for symbol: %v", name) } + enc := proto.FileDescriptor(fileNameForMeta) fd, err = s.decodeFileDesc(enc) if err != nil { return nil, err diff --git a/rpc_util.go b/rpc_util.go index 6b60095d..a25eaa8a 100644 --- a/rpc_util.go +++ b/rpc_util.go @@ -448,10 +448,10 @@ func convertCode(err error) codes.Code { return codes.Unknown } -// SupportPackageIsVersion3 is referenced from generated protocol buffer files +// SupportPackageIsVersion4 is referenced from generated protocol buffer files // to assert that that code is compatible with this version of the grpc package. // // This constant may be renamed in the future if a change in the generated code // requires a synchronised update of grpc-go and protoc-gen-go. This constant // should not be referenced from any other code. -const SupportPackageIsVersion3 = true +const SupportPackageIsVersion4 = true diff --git a/stress/grpc_testing/metrics.pb.go b/stress/grpc_testing/metrics.pb.go index 4ad4ccdb..82314411 100644 --- a/stress/grpc_testing/metrics.pb.go +++ b/stress/grpc_testing/metrics.pb.go @@ -205,7 +205,7 @@ var _ grpc.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion3 +const _ = grpc.SupportPackageIsVersion4 // Client API for MetricsService service diff --git a/test/grpc_testing/test.pb.go b/test/grpc_testing/test.pb.go index 0ceb12df..4fb127a4 100644 --- a/test/grpc_testing/test.pb.go +++ b/test/grpc_testing/test.pb.go @@ -360,7 +360,7 @@ var _ grpc.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion3 +const _ = grpc.SupportPackageIsVersion4 // Client API for TestService service From 5303e26e10ef2f255dc802b739edba2a177a29f4 Mon Sep 17 00:00:00 2001 From: Mak Mukhi Date: Fri, 21 Oct 2016 18:20:12 -0700 Subject: [PATCH 2/3] update reflection test pb.go --- reflection/grpc_testing/test.pb.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reflection/grpc_testing/test.pb.go b/reflection/grpc_testing/test.pb.go index 6dbea30d..607dfd3b 100644 --- a/reflection/grpc_testing/test.pb.go +++ b/reflection/grpc_testing/test.pb.go @@ -195,7 +195,7 @@ var _SearchService_serviceDesc = grpc.ServiceDesc{ ClientStreams: true, }, }, - Metadata: fileDescriptor2, + Metadata: "test.proto", } func init() { proto.RegisterFile("test.proto", fileDescriptor2) } From 883bfc7bc8feeb7d90501b977e1c23447b9ff136 Mon Sep 17 00:00:00 2001 From: Mahak Mukhi Date: Fri, 28 Oct 2016 12:37:56 -0700 Subject: [PATCH 3/3] pb.go file update --- benchmark/grpc_testing/services.pb.go | 4 ++-- examples/helloworld/helloworld/helloworld.pb.go | 2 +- examples/route_guide/routeguide/route_guide.pb.go | 2 +- grpclb/grpc_lb_v1/grpclb.pb.go | 2 +- health/grpc_health_v1/health.pb.go | 2 +- interop/grpc_testing/test.pb.go | 2 +- reflection/grpc_reflection_v1alpha/reflection.pb.go | 2 +- stress/grpc_testing/metrics.pb.go | 2 +- test/grpc_testing/test.pb.go | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/benchmark/grpc_testing/services.pb.go b/benchmark/grpc_testing/services.pb.go index 8afe4a8d..2aae3179 100644 --- a/benchmark/grpc_testing/services.pb.go +++ b/benchmark/grpc_testing/services.pb.go @@ -161,7 +161,7 @@ var _BenchmarkService_serviceDesc = grpc.ServiceDesc{ ClientStreams: true, }, }, - Metadata: fileDescriptor3, + Metadata: "services.proto", } // Client API for WorkerService service @@ -417,7 +417,7 @@ var _WorkerService_serviceDesc = grpc.ServiceDesc{ ClientStreams: true, }, }, - Metadata: fileDescriptor3, + Metadata: "services.proto", } func init() { proto.RegisterFile("services.proto", fileDescriptor3) } diff --git a/examples/helloworld/helloworld/helloworld.pb.go b/examples/helloworld/helloworld/helloworld.pb.go index f7b4502b..c8c8942a 100644 --- a/examples/helloworld/helloworld/helloworld.pb.go +++ b/examples/helloworld/helloworld/helloworld.pb.go @@ -130,7 +130,7 @@ var _Greeter_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: fileDescriptor0, + Metadata: "helloworld.proto", } func init() { proto.RegisterFile("helloworld.proto", fileDescriptor0) } diff --git a/examples/route_guide/routeguide/route_guide.pb.go b/examples/route_guide/routeguide/route_guide.pb.go index b7afbf5b..cbcf2f30 100644 --- a/examples/route_guide/routeguide/route_guide.pb.go +++ b/examples/route_guide/routeguide/route_guide.pb.go @@ -452,7 +452,7 @@ var _RouteGuide_serviceDesc = grpc.ServiceDesc{ ClientStreams: true, }, }, - Metadata: fileDescriptor0, + Metadata: "route_guide.proto", } func init() { proto.RegisterFile("route_guide.proto", fileDescriptor0) } diff --git a/grpclb/grpc_lb_v1/grpclb.pb.go b/grpclb/grpc_lb_v1/grpclb.pb.go index 5c8b595f..7be89477 100644 --- a/grpclb/grpc_lb_v1/grpclb.pb.go +++ b/grpclb/grpc_lb_v1/grpclb.pb.go @@ -517,7 +517,7 @@ var _LoadBalancer_serviceDesc = grpc.ServiceDesc{ ClientStreams: true, }, }, - Metadata: fileDescriptor0, + Metadata: "grpclb.proto", } func init() { proto.RegisterFile("grpclb.proto", fileDescriptor0) } diff --git a/health/grpc_health_v1/health.pb.go b/health/grpc_health_v1/health.pb.go index 4bb91cc1..89c4d459 100644 --- a/health/grpc_health_v1/health.pb.go +++ b/health/grpc_health_v1/health.pb.go @@ -153,7 +153,7 @@ var _Health_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: fileDescriptor0, + Metadata: "health.proto", } func init() { proto.RegisterFile("health.proto", fileDescriptor0) } diff --git a/interop/grpc_testing/test.pb.go b/interop/grpc_testing/test.pb.go index 9af329c2..68b97c16 100755 --- a/interop/grpc_testing/test.pb.go +++ b/interop/grpc_testing/test.pb.go @@ -789,7 +789,7 @@ var _TestService_serviceDesc = grpc.ServiceDesc{ ClientStreams: true, }, }, - Metadata: fileDescriptor0, + Metadata: "test.proto", } func init() { proto.RegisterFile("test.proto", fileDescriptor0) } diff --git a/reflection/grpc_reflection_v1alpha/reflection.pb.go b/reflection/grpc_reflection_v1alpha/reflection.pb.go index 68670306..76987a42 100644 --- a/reflection/grpc_reflection_v1alpha/reflection.pb.go +++ b/reflection/grpc_reflection_v1alpha/reflection.pb.go @@ -643,7 +643,7 @@ var _ServerReflection_serviceDesc = grpc.ServiceDesc{ ClientStreams: true, }, }, - Metadata: fileDescriptor0, + Metadata: "reflection.proto", } func init() { proto.RegisterFile("reflection.proto", fileDescriptor0) } diff --git a/stress/grpc_testing/metrics.pb.go b/stress/grpc_testing/metrics.pb.go index 82314411..a1310b5f 100644 --- a/stress/grpc_testing/metrics.pb.go +++ b/stress/grpc_testing/metrics.pb.go @@ -335,7 +335,7 @@ var _MetricsService_serviceDesc = grpc.ServiceDesc{ ServerStreams: true, }, }, - Metadata: fileDescriptor0, + Metadata: "metrics.proto", } func init() { proto.RegisterFile("metrics.proto", fileDescriptor0) } diff --git a/test/grpc_testing/test.pb.go b/test/grpc_testing/test.pb.go index 4fb127a4..e584c4d6 100644 --- a/test/grpc_testing/test.pb.go +++ b/test/grpc_testing/test.pb.go @@ -742,7 +742,7 @@ var _TestService_serviceDesc = grpc.ServiceDesc{ ClientStreams: true, }, }, - Metadata: fileDescriptor0, + Metadata: "test.proto", } func init() { proto.RegisterFile("test.proto", fileDescriptor0) }