zeromicro / go-zero

A cloud-native Go microservices framework with cli tool for productivity.
https://go-zero.dev
MIT License
29.41k stars 3.97k forks source link

Add a flag to whether to generate pb file #4078

Open wuqinqiang opened 7 months ago

wuqinqiang commented 7 months ago

Is your feature request related to a problem? Please describe.

Currently, PB files do not support external imports, which makes it inconvenient to directly apply certain plugins as they require additional processing. For instance, basic plugins like protoc-gen-validate can not be used directly.

The ProtocCmd assembled by the GenPb function within goctl is somewhat insufficient. For my purposes, I only want to generate the framework's core code. As for managing and generating pb files, I prefer using buf.

demo

Therefore, I'd like to add a flag that allows skipping the generation of GenPb and only generates the core framework code.

Describe the solution you'd like Add a flag: --pb

# skip generate GenPb 
goctl rpc protoc proto/demo2.proto --pb=false  ...........

Describe alternatives you've considered

Additional context

wuqinqiang commented 7 months ago

@kevwan Will this be open -_-?