Is your feature request related to a problem? Please describe.
I'm always frustrated when generating gRPC client code for go-zero API gateway. Currently, the goctl rpc protoc command always generates a complete RPC server skeleton, including redundant etc, internal, and service entry files, even if I only need the RPC client for API service invocation.
These extra server files are completely unnecessary for API gateway projects and require manual deletion every time, which is redundant and inefficient for cross-language gRPC invocation scenarios (e.g., calling Python gRPC services registered in etcd).
Describe the solution you'd like
I would like to add a --client-only flag for the goctl rpc protoc command.
When this flag is enabled:
- Only generate pb.go, grpc.pb.go and go-zero wrapped rpc client code
- Skip generating all server-side code, including etc, internal, service main file and server implementation code
This allows developers to generate clean client code specifically for API gateway consumption.
Describe alternatives you've considered
- Manually delete redundant server files after each generation (error-prone and inefficient)
- Use pure native protoc command without go-zero client encapsulation (lose go-zero's zrpc capability like service discovery, circuit breaker, load balancing)
No clean and official solution exists for pure client generation right now.
Additional context
In go-zero layered architecture, API services only depend on RPC clients and never host RPC server services. A dedicated client-only generation flag fits the official layered design and greatly improves development experience for microservice gateway scenarios.
Is your feature request related to a problem? Please describe.
I'm always frustrated when generating gRPC client code for go-zero API gateway. Currently, the goctl rpc protoc command always generates a complete RPC server skeleton, including redundant etc, internal, and service entry files, even if I only need the RPC client for API service invocation.
These extra server files are completely unnecessary for API gateway projects and require manual deletion every time, which is redundant and inefficient for cross-language gRPC invocation scenarios (e.g., calling Python gRPC services registered in etcd).
Describe the solution you'd like
I would like to add a --client-only flag for the goctl rpc protoc command.
When this flag is enabled:
This allows developers to generate clean client code specifically for API gateway consumption.
Describe alternatives you've considered
No clean and official solution exists for pure client generation right now.
Additional context
In go-zero layered architecture, API services only depend on RPC clients and never host RPC server services. A dedicated client-only generation flag fits the official layered design and greatly improves development experience for microservice gateway scenarios.