Commit 347cf4a
authored
protoc-gen-go: fix oneof name mangling regression (#782)
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 #7801 parent 1d3f30b commit 347cf4a
File tree
3 files changed
+114
-3
lines changed- protoc-gen-go
- generator
- testdata/issue780_oneof_conflict
3 files changed
+114
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2246 | 2246 | | |
2247 | 2247 | | |
2248 | 2248 | | |
2249 | | - | |
2250 | | - | |
| 2249 | + | |
2251 | 2250 | | |
2252 | 2251 | | |
2253 | 2252 | | |
| |||
2265 | 2264 | | |
2266 | 2265 | | |
2267 | 2266 | | |
2268 | | - | |
| 2267 | + | |
2269 | 2268 | | |
2270 | 2269 | | |
2271 | 2270 | | |
| |||
Lines changed: 103 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
0 commit comments