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

protoc-gen-go: fix oneof name mangling regression #782

Merged
merged 1 commit into from Jan 9, 2019

Conversation

Projects
None yet
2 participants
@dsnet
Copy link
Member

dsnet commented Jan 8, 2019

The generator currently uses an unintuitive and stateful algorithm
for name generation where it "fixes" name conflicts by appending "_"
to the end of the new name.

PR#657 refactored the generator code and noticed that the above
algorithm was not properly taking into account that a Get method is
generated for parent oneofs, fixing it in the same PR. While this is
more correct, this breaks users (see #780) since it means that the
generation of names can change.

This PR changes the name mangling logic to be as it was previously.
This does mean that some new proto files may be unbuildable,
but that is arguably better than breaking existing proto files.

Fixes #780

protoc-gen-go: fix oneof name mangling regression
The generator currently uses an unintuitive and stateful algorithm
for name generation where it "fixes" name conflicts by appending "_"
to the end of the new name.

PR#657 refactored the generator code and noticed that the above
algorithm was not properly taking into account that a Get method is
generated for parent oneofs, fixing it in the same PR. While this is
more correct, this breaks users (see #780) since it means that the
generation of names can change.

This PR changes the name mangling logic to be as it was previously.
This does mean that some new proto files may be unbuildable,
but that is arguably better than breaking existing proto files.

Fixes #780

@dsnet dsnet requested a review from neild Jan 8, 2019

@neild

neild approved these changes Jan 8, 2019

Copy link
Contributor

neild left a comment

Sigh.

@dsnet

This comment has been minimized.

Copy link
Member

dsnet commented Jan 8, 2019

Before submitting, I'll run this through code at Google to make sure nothing depends on the new mangling semantics.

@dsnet

This comment has been minimized.

Copy link
Member

dsnet commented Jan 9, 2019

No failures.

@dsnet dsnet merged commit 347cf4a into master Jan 9, 2019

3 checks passed

cla/google All necessary CLAs are signed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@dsnet dsnet deleted the oneof-conflict branch Jan 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment