Skip to content

Conversation

HeimaoLST
Copy link

@HeimaoLST HeimaoLST commented Sep 9, 2025

…mpty(#3715)

Description (what this PR does / why we need it):

This PR fixes a bug in the kratos proto server command where it generates incorrect Go code when google.protobuf.Empty is used as a request or response type in an RPC method.

Previous Behavior:

The command would incorrectly generate types like *pb.google_protobuf_Empty, which do not exist and cause compilation errors.

Root Cause:

The bug was caused by the parametersName helper function in internal/proto/server/server.go. This function indiscriminately replaced all dots (.) with underscores (_) in parameter type names. This behavior incorrectly transformed the well-known type "google.protobuf.Empty" into "google_protobuf_Empty".

This PR's Fix:

This PR corrects the behavior by updating the parametersName function. It now includes a check to see if the input name is exactly "google.protobuf.Empty". If it is, the function returns the original string without modification. For all other type names, the existing replacement logic is preserved.

Which issue(s) this PR fixes (resolves / be part of):

fixes #3715

Other special notes for the reviewers:

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Sep 9, 2025
@HeimaoLST HeimaoLST changed the title fix: #3715 fix(proto): correct code generation for google.protobuf.Empty (#3715) Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code generation for google.protobuf.Empty produces invalid type *pb.google_protobuf_Empty

1 participant