Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only one service expected #3762

Closed
GuoxinL opened this issue Dec 7, 2023 · 2 comments
Closed

only one service expected #3762

GuoxinL opened this issue Dec 7, 2023 · 2 comments
Labels
area/goctl Categorizes issue or PR as related to goctl.

Comments

@GuoxinL
Copy link

GuoxinL commented Dec 7, 2023

Describe the bug
The document describes that multiple services can be defined in proto, but the error "only one service expected" is reported in actual use.

To Reproduce
Steps to reproduce the behavior, if applicable:

// 声明 proto 语法版本,固定值
syntax = "proto3";

// proto 包名
package greet;

// 生成 golang 代码后的包名
option go_package = "example/proto/greet";

// 定义结构体
message SendMessageReq{
  string message = 1;
}
message SendMessageResp{
  int32 status = 1;
}

message GetMessageReq{
  int32 id = 1;
}
message GetMessageResp{
  string message = 1;
}

// 定义 Greet 服务
service Greet {
  // 定义客户端流式 rpc
  rpc SendMessage(stream SendMessageReq) returns (SendMessageResp);
  // 定义服务端流式 rpc
  rpc GetMessage(GetMessageReq) returns (stream GetMessageResp);
  // 定义双向流式 rpc
  rpc PushMessage(stream SendMessageReq) returns (stream GetMessageResp);
}

// 定义 Message 服务
service Message {
  // 定义客户端流式 rpc
  rpc SendMessage(stream SendMessageReq) returns (SendMessageResp);
  // 定义服务端流式 rpc
  rpc GetMessage(GetMessageReq) returns (stream GetMessageResp);
  // 定义双向流式 rpc
  rpc PushMessage(stream SendMessageReq) returns (stream GetMessageResp);
}
  1. The code is

    goctl rpc protoc ./proto/greet.proto --go_out=./test --go-grpc_out=./test --zrpc_out=./test

image

  1. The error is

    only one service expected
    

Expected behavior
A clear and concise description of what you expected to happen.
You want to support multiple services to generate Protos

Screenshots
If applicable, add screenshots to help explain your problem.

Environments (please complete the following information):

  • OS: [e.g. Linux]
  • go-zero version [e.g. 1.2.1]
  • goctl version [e.g. 1.2.1, optional]
    image

More description
Add any other context about the problem here.

@chenquan
Copy link
Member

chenquan commented Dec 7, 2023

Refer to the documentation:https://go-zero.dev/docs/tutorials/cli/rpc
image

@GuoxinL
Copy link
Author

GuoxinL commented Dec 7, 2023

wow, thank you.

@zeromicro zeromicro deleted a comment from Issues-translate-bot Dec 9, 2023
@kevwan kevwan added the area/goctl Categorizes issue or PR as related to goctl. label Dec 9, 2023
@kevwan kevwan closed this as completed Dec 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/goctl Categorizes issue or PR as related to goctl.
Projects
None yet
Development

No branches or pull requests

3 participants