-
Notifications
You must be signed in to change notification settings - Fork 4.5k
cmd/protoc-gen-go-grpc: Add flag to use separate service package #8280
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?
cmd/protoc-gen-go-grpc: Add flag to use separate service package #8280
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8280 +/- ##
==========================================
+ Coverage 82.13% 82.19% +0.06%
==========================================
Files 417 417
Lines 41385 41385
==========================================
+ Hits 33991 34018 +27
+ Misses 5961 5941 -20
+ Partials 1433 1426 -7 🚀 New features to boost your workflow:
|
@@ -58,6 +61,7 @@ func main() { | |||
var flags flag.FlagSet | |||
requireUnimplemented = flags.Bool("require_unimplemented_servers", true, "set to false to match legacy behavior") | |||
useGenericStreams = flags.Bool("use_generic_streams_experimental", true, "set to true to use generic types for streaming client and server objects; this flag is EXPERIMENTAL and may be changed or removed in a future release") | |||
useSeparateServicePackage = flags.Bool("use_separate_service_package", false, "set to true to use separate service package, service package will import protobuf package") |
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.
How about something like: name this output_package
and make it a string? Then the import path could be file.GoImportPath
with everything after the last /
stripped and replaced by what's specified here? That would allow more flexibility for how the code is generated.
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 import path becomes unnecessary after the file is generated.
62d01f8
to
a79e9fb
Compare
Fixes: #8233
Release notes for cmd/protoc-gen-go-grpc:
use_separate_service_package
has been added to support generating service and message code in separate packages. When this flag is set totrue
, the service code will import the message package and refer to message symbols using package-qualified names. Since both the service and message code still share the same package names, users must either use the--go-grpc_out
flag to place the service code in a different directory or manually move it.RELEASE NOTES: none