diff --git a/tools/testserver/math/math.pb.go b/tools/testserver/math/math.pb.go index c4bfd46b9..6fad8e207 100644 --- a/tools/testserver/math/math.pb.go +++ b/tools/testserver/math/math.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.17.3 +// protoc-gen-go v1.35.2 +// protoc v5.29.0 // source: tools/testserver/math/math.proto package math @@ -31,11 +31,9 @@ type Input struct { func (x *Input) Reset() { *x = Input{} - if protoimpl.UnsafeEnabled { - mi := &file_tools_testserver_math_math_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_tools_testserver_math_math_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Input) String() string { @@ -46,7 +44,7 @@ func (*Input) ProtoMessage() {} func (x *Input) ProtoReflect() protoreflect.Message { mi := &file_tools_testserver_math_math_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -85,11 +83,9 @@ type Output struct { func (x *Output) Reset() { *x = Output{} - if protoimpl.UnsafeEnabled { - mi := &file_tools_testserver_math_math_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_tools_testserver_math_math_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Output) String() string { @@ -100,7 +96,7 @@ func (*Output) ProtoMessage() {} func (x *Output) ProtoReflect() protoreflect.Message { mi := &file_tools_testserver_math_math_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -131,14 +127,14 @@ var file_tools_testserver_math_math_proto_rawDesc = []byte{ 0x74, 0x12, 0x0c, 0x0a, 0x01, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x01, 0x61, 0x12, 0x0c, 0x0a, 0x01, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x01, 0x62, 0x22, 0x16, 0x0a, 0x06, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x0c, 0x0a, 0x01, 0x63, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x01, 0x63, 0x32, 0x57, 0x0a, 0x0b, 0x4d, 0x61, 0x74, 0x68, 0x53, 0x65, 0x72, + 0x28, 0x03, 0x52, 0x01, 0x63, 0x32, 0x56, 0x0a, 0x0b, 0x4d, 0x61, 0x74, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x20, 0x0a, 0x03, 0x41, 0x64, 0x64, 0x12, 0x0b, 0x2e, 0x4d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x1a, 0x0c, 0x2e, 0x4d, 0x61, 0x74, 0x68, 0x2e, - 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x26, 0x0a, 0x09, 0x53, 0x75, 0x62, 0x73, 0x74, 0x72, - 0x61, 0x63, 0x74, 0x12, 0x0b, 0x2e, 0x4d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, - 0x1a, 0x0c, 0x2e, 0x4d, 0x61, 0x74, 0x68, 0x2e, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x42, 0x17, - 0x5a, 0x15, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x25, 0x0a, 0x08, 0x53, 0x75, 0x62, 0x74, 0x72, 0x61, + 0x63, 0x74, 0x12, 0x0b, 0x2e, 0x4d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x1a, + 0x0c, 0x2e, 0x4d, 0x61, 0x74, 0x68, 0x2e, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x42, 0x17, 0x5a, + 0x15, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -154,15 +150,15 @@ func file_tools_testserver_math_math_proto_rawDescGZIP() []byte { } var file_tools_testserver_math_math_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_tools_testserver_math_math_proto_goTypes = []interface{}{ +var file_tools_testserver_math_math_proto_goTypes = []any{ (*Input)(nil), // 0: Math.Input (*Output)(nil), // 1: Math.Output } var file_tools_testserver_math_math_proto_depIdxs = []int32{ 0, // 0: Math.MathService.Add:input_type -> Math.Input - 0, // 1: Math.MathService.Substract:input_type -> Math.Input + 0, // 1: Math.MathService.Subtract:input_type -> Math.Input 1, // 2: Math.MathService.Add:output_type -> Math.Output - 1, // 3: Math.MathService.Substract:output_type -> Math.Output + 1, // 3: Math.MathService.Subtract:output_type -> Math.Output 2, // [2:4] is the sub-list for method output_type 0, // [0:2] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name @@ -175,32 +171,6 @@ func file_tools_testserver_math_math_proto_init() { if File_tools_testserver_math_math_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_tools_testserver_math_math_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Input); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_tools_testserver_math_math_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Output); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/tools/testserver/math/math_grpc.pb.go b/tools/testserver/math/math_grpc.pb.go index d234815b2..b0f4ad1d2 100644 --- a/tools/testserver/math/math_grpc.pb.go +++ b/tools/testserver/math/math_grpc.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.0 +// source: tools/testserver/math/math.proto package math @@ -11,15 +15,20 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + MathService_Add_FullMethodName = "/Math.MathService/Add" + MathService_Subtract_FullMethodName = "/Math.MathService/Subtract" +) // MathServiceClient is the client API for MathService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type MathServiceClient interface { Add(ctx context.Context, in *Input, opts ...grpc.CallOption) (*Output, error) - Substract(ctx context.Context, in *Input, opts ...grpc.CallOption) (*Output, error) + Subtract(ctx context.Context, in *Input, opts ...grpc.CallOption) (*Output, error) } type mathServiceClient struct { @@ -31,17 +40,19 @@ func NewMathServiceClient(cc grpc.ClientConnInterface) MathServiceClient { } func (c *mathServiceClient) Add(ctx context.Context, in *Input, opts ...grpc.CallOption) (*Output, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Output) - err := c.cc.Invoke(ctx, "/Math.MathService/Add", in, out, opts...) + err := c.cc.Invoke(ctx, MathService_Add_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *mathServiceClient) Substract(ctx context.Context, in *Input, opts ...grpc.CallOption) (*Output, error) { +func (c *mathServiceClient) Subtract(ctx context.Context, in *Input, opts ...grpc.CallOption) (*Output, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Output) - err := c.cc.Invoke(ctx, "/Math.MathService/Substract", in, out, opts...) + err := c.cc.Invoke(ctx, MathService_Subtract_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -50,24 +61,28 @@ func (c *mathServiceClient) Substract(ctx context.Context, in *Input, opts ...gr // MathServiceServer is the server API for MathService service. // All implementations must embed UnimplementedMathServiceServer -// for forward compatibility +// for forward compatibility. type MathServiceServer interface { Add(context.Context, *Input) (*Output, error) - Substract(context.Context, *Input) (*Output, error) + Subtract(context.Context, *Input) (*Output, error) mustEmbedUnimplementedMathServiceServer() } -// UnimplementedMathServiceServer must be embedded to have forward compatible implementations. -type UnimplementedMathServiceServer struct { -} +// UnimplementedMathServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedMathServiceServer struct{} func (UnimplementedMathServiceServer) Add(context.Context, *Input) (*Output, error) { return nil, status.Errorf(codes.Unimplemented, "method Add not implemented") } -func (UnimplementedMathServiceServer) Substract(context.Context, *Input) (*Output, error) { - return nil, status.Errorf(codes.Unimplemented, "method Substract not implemented") +func (UnimplementedMathServiceServer) Subtract(context.Context, *Input) (*Output, error) { + return nil, status.Errorf(codes.Unimplemented, "method Subtract not implemented") } func (UnimplementedMathServiceServer) mustEmbedUnimplementedMathServiceServer() {} +func (UnimplementedMathServiceServer) testEmbeddedByValue() {} // UnsafeMathServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to MathServiceServer will @@ -77,6 +92,13 @@ type UnsafeMathServiceServer interface { } func RegisterMathServiceServer(s grpc.ServiceRegistrar, srv MathServiceServer) { + // If the following call pancis, it indicates UnimplementedMathServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&MathService_ServiceDesc, srv) } @@ -90,7 +112,7 @@ func _MathService_Add_Handler(srv interface{}, ctx context.Context, dec func(int } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/Math.MathService/Add", + FullMethod: MathService_Add_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MathServiceServer).Add(ctx, req.(*Input)) @@ -98,20 +120,20 @@ func _MathService_Add_Handler(srv interface{}, ctx context.Context, dec func(int return interceptor(ctx, in, info, handler) } -func _MathService_Substract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _MathService_Subtract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(Input) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MathServiceServer).Substract(ctx, in) + return srv.(MathServiceServer).Subtract(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/Math.MathService/Substract", + FullMethod: MathService_Subtract_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MathServiceServer).Substract(ctx, req.(*Input)) + return srv.(MathServiceServer).Subtract(ctx, req.(*Input)) } return interceptor(ctx, in, info, handler) } @@ -128,8 +150,8 @@ var MathService_ServiceDesc = grpc.ServiceDesc{ Handler: _MathService_Add_Handler, }, { - MethodName: "Substract", - Handler: _MathService_Substract_Handler, + MethodName: "Subtract", + Handler: _MathService_Subtract_Handler, }, }, Streams: []grpc.StreamDesc{},