-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
feat(goctl): add rpc_name flag for generating rpc service code #5047
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
base: master
Are you sure you want to change the base?
Conversation
- Add --rpc_name flag to set the RPC service name - Update configuration file and main file generation to use the specified service name - Modify README to include new flag description and usage examples - Enhance support for generating code from multiple proto files within the same service
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new --rpc_name
flag to the goctl rpc protoc
command, allowing users to specify a custom RPC service name instead of defaulting to the proto file name. This enables generating RPC service code from multiple proto files within the same service by providing a unified service name.
- Adds
--rpc_name
flag to override default service naming behavior - Modifies generators to use the custom RPC name when provided
- Updates documentation and help text for the new flag
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
tools/goctl/rpc/generator/genmain.go | Updates main file generation to use custom RPC name when provided |
tools/goctl/rpc/generator/genetc.go | Updates etc file generation to use custom RPC name and adds ZRpcContext parameter |
tools/goctl/rpc/generator/gen.go | Adds RpcName field to ZRpcContext struct and passes context to GenEtc |
tools/goctl/rpc/cmd.go | Registers the new rpc_name flag in the protoc command |
tools/goctl/rpc/cli/zrpc.go | Sets RpcName field from command line flag |
tools/goctl/rpc/cli/cli.go | Declares VarStringRpcName variable and sets it in RPCNew function |
tools/goctl/rpc/README.md | Documents the new --rpc_name flag with usage examples |
tools/goctl/internal/flags/default_en.json | Adds help text for the rpc_name flag |
tools/goctl/rpc/cli/cli.go
Outdated
VarStringStyle string | ||
// VarStringZRPCOut describes the zRPC output. | ||
VarStringZRPCOut string | ||
// VarStringRpcName describe the rpc name |
Copilot
AI
Aug 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment has a grammatical error. It should be "VarStringRpcName describes the rpc name" (missing 's' in 'describe').
// VarStringRpcName describe the rpc name | |
// VarStringRpcName describes the rpc name |
Copilot uses AI. Check for mistakes.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
"verbose": "Enable log output", | ||
"client": "Whether to generate rpc client" | ||
"client": "Whether to generate rpc client", | ||
"rpc_name": "Rpc service name. Setting the rpc service name prevents it from defaulting to the proto file name. This enables the use of multiple proto files within the same service for code generation" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use name
instead of rpc_name
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
- Add --rpc_name flag to set the RPC service name - Update configuration file and main file generation to use the specified service name - Modify README to include new flag description and usage examples - Enhance support for generating code from multiple proto files within the same service
537d12d
to
312fda3
Compare
…at-add-rpc-name # Conflicts: # tools/goctl/internal/flags/default_en.json # tools/goctl/rpc/README.md # tools/goctl/rpc/cli/cli.go # tools/goctl/rpc/cli/zrpc.go # tools/goctl/rpc/cmd.go # tools/goctl/rpc/generator/gen.go # tools/goctl/rpc/generator/genetc.go # tools/goctl/rpc/generator/genmain.go
- Change --rpc_name to --name in the goctl rpc command description
# Conflicts: # tools/goctl/rpc/cli/cli.go # tools/goctl/rpc/cli/zrpc.go # tools/goctl/rpc/cmd.go
@gszw90 Can you please resolve the conflict and AI comment's? |
…at-add-rpc-name # Conflicts: # tools/goctl/rpc/cli/cli.go # tools/goctl/rpc/cli/zrpc.go # tools/goctl/rpc/cmd.go
done @kesonan |
Add the --rpc_name flag to the
goctl rpc protoc
command to set the RPC service name instead of using the proto file name.It also allows to generate rpc service code from multiple proto files within the same service.
run:
generate files: