From 0c6d80cc8f3ac6d133f116f64f1222f3d09a0f0c Mon Sep 17 00:00:00 2001 From: Arvind Bright Date: Tue, 16 Apr 2024 15:24:28 -0700 Subject: [PATCH] chore: fix lint (#7133) --- cmd/protoc-gen-go-grpc/testdata/golden.pb.go | 24 +++++++++---------- cmd/protoc-gen-go-grpc/testdata/golden.proto | 12 ++++++---- .../testdata/golden_grpc.pb.go | 24 ++++++++++++------- reflection/test/serverreflection_test.go | 2 +- 4 files changed, 37 insertions(+), 25 deletions(-) diff --git a/cmd/protoc-gen-go-grpc/testdata/golden.pb.go b/cmd/protoc-gen-go-grpc/testdata/golden.pb.go index 5e9b454a27eb..5f146ab4999c 100644 --- a/cmd/protoc-gen-go-grpc/testdata/golden.pb.go +++ b/cmd/protoc-gen-go-grpc/testdata/golden.pb.go @@ -141,19 +141,19 @@ var file_cmd_protoc_gen_go_grpc_testdata_golden_proto_rawDesc = []byte{ 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x32, 0x99, 0x02, 0x0a, 0x1d, 0x42, 0x69, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x65, 0x61, - 0x6d, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x38, 0x0a, 0x0b, 0x75, + 0x6d, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x38, 0x0a, 0x0b, 0x55, 0x6e, 0x61, 0x72, 0x79, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x12, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x0c, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x12, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, - 0x28, 0x01, 0x12, 0x3b, 0x0a, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x68, + 0x28, 0x01, 0x12, 0x3b, 0x0a, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x12, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, - 0x44, 0x0a, 0x13, 0x62, 0x69, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, + 0x44, 0x0a, 0x13, 0x42, 0x69, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x12, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, @@ -182,14 +182,14 @@ var file_cmd_protoc_gen_go_grpc_testdata_golden_proto_goTypes = []interface{}{ (*EventResponse)(nil), // 1: main.EventResponse } var file_cmd_protoc_gen_go_grpc_testdata_golden_proto_depIdxs = []int32{ - 0, // 0: main.BidirectionalStreamingService.unaryMethod:input_type -> main.EventRequest - 0, // 1: main.BidirectionalStreamingService.clientMethod:input_type -> main.EventRequest - 0, // 2: main.BidirectionalStreamingService.serverMethod:input_type -> main.EventRequest - 0, // 3: main.BidirectionalStreamingService.bidirectionalMethod:input_type -> main.EventRequest - 1, // 4: main.BidirectionalStreamingService.unaryMethod:output_type -> main.EventResponse - 1, // 5: main.BidirectionalStreamingService.clientMethod:output_type -> main.EventResponse - 1, // 6: main.BidirectionalStreamingService.serverMethod:output_type -> main.EventResponse - 1, // 7: main.BidirectionalStreamingService.bidirectionalMethod:output_type -> main.EventResponse + 0, // 0: main.BidirectionalStreamingService.UnaryMethod:input_type -> main.EventRequest + 0, // 1: main.BidirectionalStreamingService.ClientMethod:input_type -> main.EventRequest + 0, // 2: main.BidirectionalStreamingService.ServerMethod:input_type -> main.EventRequest + 0, // 3: main.BidirectionalStreamingService.BidirectionalMethod:input_type -> main.EventRequest + 1, // 4: main.BidirectionalStreamingService.UnaryMethod:output_type -> main.EventResponse + 1, // 5: main.BidirectionalStreamingService.ClientMethod:output_type -> main.EventResponse + 1, // 6: main.BidirectionalStreamingService.ServerMethod:output_type -> main.EventResponse + 1, // 7: main.BidirectionalStreamingService.BidirectionalMethod:output_type -> main.EventResponse 4, // [4:8] is the sub-list for method output_type 0, // [0:4] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name diff --git a/cmd/protoc-gen-go-grpc/testdata/golden.proto b/cmd/protoc-gen-go-grpc/testdata/golden.proto index 08fc060ee6fb..1aff384571b2 100644 --- a/cmd/protoc-gen-go-grpc/testdata/golden.proto +++ b/cmd/protoc-gen-go-grpc/testdata/golden.proto @@ -27,8 +27,12 @@ message EventResponse { } service BidirectionalStreamingService { - rpc unaryMethod(EventRequest) returns (EventResponse) {} - rpc clientMethod(stream EventRequest) returns (EventResponse) {} - rpc serverMethod(EventRequest) returns (stream EventResponse) {} - rpc bidirectionalMethod(stream EventRequest) returns (stream EventResponse) {} + // UnaryMethod is a sample unary method. + rpc UnaryMethod(EventRequest) returns (EventResponse) {} + // ClientMethod is a sample client streaming method. + rpc ClientMethod(stream EventRequest) returns (EventResponse) {} + // ServerMethod is a sample server streaming method. + rpc ServerMethod(EventRequest) returns (stream EventResponse) {} + // BidirectionalMethod is a sample bidirectional streaming method. + rpc BidirectionalMethod(stream EventRequest) returns (stream EventResponse) {} } diff --git a/cmd/protoc-gen-go-grpc/testdata/golden_grpc.pb.go b/cmd/protoc-gen-go-grpc/testdata/golden_grpc.pb.go index 7c5ffaec61b1..2d599a1d437c 100644 --- a/cmd/protoc-gen-go-grpc/testdata/golden_grpc.pb.go +++ b/cmd/protoc-gen-go-grpc/testdata/golden_grpc.pb.go @@ -33,19 +33,23 @@ import ( const _ = grpc.SupportPackageIsVersion8 const ( - BidirectionalStreamingService_UnaryMethod_FullMethodName = "/main.BidirectionalStreamingService/unaryMethod" - BidirectionalStreamingService_ClientMethod_FullMethodName = "/main.BidirectionalStreamingService/clientMethod" - BidirectionalStreamingService_ServerMethod_FullMethodName = "/main.BidirectionalStreamingService/serverMethod" - BidirectionalStreamingService_BidirectionalMethod_FullMethodName = "/main.BidirectionalStreamingService/bidirectionalMethod" + BidirectionalStreamingService_UnaryMethod_FullMethodName = "/main.BidirectionalStreamingService/UnaryMethod" + BidirectionalStreamingService_ClientMethod_FullMethodName = "/main.BidirectionalStreamingService/ClientMethod" + BidirectionalStreamingService_ServerMethod_FullMethodName = "/main.BidirectionalStreamingService/ServerMethod" + BidirectionalStreamingService_BidirectionalMethod_FullMethodName = "/main.BidirectionalStreamingService/BidirectionalMethod" ) // BidirectionalStreamingServiceClient is the client API for BidirectionalStreamingService 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 BidirectionalStreamingServiceClient interface { + // UnaryMethod is a sample unary method. UnaryMethod(ctx context.Context, in *EventRequest, opts ...grpc.CallOption) (*EventResponse, error) + // ClientMethod is a sample client streaming method. ClientMethod(ctx context.Context, opts ...grpc.CallOption) (BidirectionalStreamingService_ClientMethodClient, error) + // ServerMethod is a sample server streaming method. ServerMethod(ctx context.Context, in *EventRequest, opts ...grpc.CallOption) (BidirectionalStreamingService_ServerMethodClient, error) + // BidirectionalMethod is a sample bidirectional streaming method. BidirectionalMethod(ctx context.Context, opts ...grpc.CallOption) (BidirectionalStreamingService_BidirectionalMethodClient, error) } @@ -171,9 +175,13 @@ func (x *bidirectionalStreamingServiceBidirectionalMethodClient) Recv() (*EventR // All implementations must embed UnimplementedBidirectionalStreamingServiceServer // for forward compatibility type BidirectionalStreamingServiceServer interface { + // UnaryMethod is a sample unary method. UnaryMethod(context.Context, *EventRequest) (*EventResponse, error) + // ClientMethod is a sample client streaming method. ClientMethod(BidirectionalStreamingService_ClientMethodServer) error + // ServerMethod is a sample server streaming method. ServerMethod(*EventRequest, BidirectionalStreamingService_ServerMethodServer) error + // BidirectionalMethod is a sample bidirectional streaming method. BidirectionalMethod(BidirectionalStreamingService_BidirectionalMethodServer) error mustEmbedUnimplementedBidirectionalStreamingServiceServer() } @@ -307,23 +315,23 @@ var BidirectionalStreamingService_ServiceDesc = grpc.ServiceDesc{ HandlerType: (*BidirectionalStreamingServiceServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "unaryMethod", + MethodName: "UnaryMethod", Handler: _BidirectionalStreamingService_UnaryMethod_Handler, }, }, Streams: []grpc.StreamDesc{ { - StreamName: "clientMethod", + StreamName: "ClientMethod", Handler: _BidirectionalStreamingService_ClientMethod_Handler, ClientStreams: true, }, { - StreamName: "serverMethod", + StreamName: "ServerMethod", Handler: _BidirectionalStreamingService_ServerMethod_Handler, ServerStreams: true, }, { - StreamName: "bidirectionalMethod", + StreamName: "BidirectionalMethod", Handler: _BidirectionalStreamingService_BidirectionalMethod_Handler, ServerStreams: true, ClientStreams: true, diff --git a/reflection/test/serverreflection_test.go b/reflection/test/serverreflection_test.go index 40257f1d71aa..bc7bcdb31f95 100644 --- a/reflection/test/serverreflection_test.go +++ b/reflection/test/serverreflection_test.go @@ -16,7 +16,7 @@ * */ -package test +package test_test import ( "context"