fix: resolve variable name conflicts in GoRPC client generation#80
Merged
franklinkim merged 9 commits intomainfrom Nov 7, 2025
Merged
fix: resolve variable name conflicts in GoRPC client generation#80franklinkim merged 9 commits intomainfrom
franklinkim merged 9 commits intomainfrom
Conversation
The GoRPC client generator was creating variable name conflicts when service method parameters had the same name as internally generated variables. The generator uses fixed variable names like 'req' for request structs, but if a method parameter was also named 'req', it would create a naming conflict in the generated code. Another change fixes the problem with a function definition having context.Context as one of its arguments, the generated code would have the context argument twice then.
…-naming-conflicts
franklinkim
requested changes
Nov 6, 2025
Member
franklinkim
left a comment
There was a problem hiding this comment.
There are some more vars that need to be replaced and I'll handle the context a bit different... hang on
…gotsrpc into fix/go-generator-naming-conflicts
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #80 +/- ##
========================================
+ Coverage 1.87% 2.11% +0.23%
========================================
Files 62 69 +7
Lines 6815 7181 +366
========================================
+ Hits 128 152 +24
- Misses 6669 7011 +342
Partials 18 18 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Member
|
@quwe66 renamed more vars that could conflict. Also, while I was on it: i took your
|
franklinkim
approved these changes
Nov 7, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The GoRPC client generator was creating variable name conflicts when service method parameters had the same name as internally generated variables. The generator uses fixed variable names like 'req' for request structs, but if a method parameter was also named 'req', it would create a naming conflict in the generated code.
Example of the conflict:
Changes:
This ensures that:
Fixes compilation errors when service methods have parameters with names that conflict with internally generated variable names (like 'req', 'response', etc.).