Repository navigation
THRIFT-6391: Import packages that collide with -remote stub locals under an alias - #3971
Merged
Merged
Conversation
slachiewicz
force-pushed
the
THRIFT-6391
branch
from
September 27, 2026 17:28
032e112 to
5189995
Compare
Member
Author
|
The lib-d job here timed out in |
slachiewicz
force-pushed
the
THRIFT-6391
branch
from
October 1, 2026 05:24
5189995 to
4339c64
Compare
slachiewicz
marked this pull request as ready for review
October 7, 2026 21:22
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Alias generation can select an identifier already assigned to another imported package.
1 open finding
What changed in this PR
Updates Go code generation to prevent -remote stub locals from shadowing imported Thrift packages.
Changes:
- Reserves generated remote-stub local names before import allocation.
- Adds compile-time regression fixtures for
clientandhostpackage collisions. - Includes generated packages and remote executable in Go checks.
| File | Description |
|---|---|
compiler/cpp/src/thrift/generate/t_go_generator.cc |
Reserves remote-stub identifiers. |
lib/go/test/Makefile.am |
Generates, builds, and distributes regression fixtures. |
lib/go/test/RemoteShadowTest.thrift |
Defines the regression service. |
lib/go/test/RemoteShadowClient.thrift |
Adds the colliding client package. |
lib/go/test/RemoteShadowHost.thrift |
Adds the colliding host package. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
fishy
reviewed
Oct 7, 2026
slachiewicz
force-pushed
the
THRIFT-6391
branch
from
October 11, 2026 14:04
4339c64 to
c44cc6c
Compare
…der an alias Client: go The Go -remote stub's main() declares locals such as client, cmd and host, which shadowed an imported package of the same name, so the stub did not compile. Apache Accumulo (client.thrift) and Apache Pegasus (package cmd) hit it. The stub now gets import identifiers of its own, with those names reserved, so such a package is imported under an alias there; the program's other files are generated as before. An alias is also never one already taken by another import. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
slachiewicz
force-pushed
the
THRIFT-6391
branch
from
October 11, 2026 14:32
c44cc6c to
8326ab1
Compare
fishy
approved these changes
Oct 11, 2026
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 Go
-remotestub'smain()declares locals such asclient,cmdandhost, which shadowed an imported package of the same name, so the stub did not compile. The stub now gets import identifiers of its own with those names reserved, so such a package is imported under an alias there; the program's other files are generated as before. An alias is also never a name another import already uses. lib/go/test gains a service whose arguments come from packages namedclient,hostandclient0.Elsewhere in lib/go/test and test/v0.16, the generated code changes in one place: an alias in the
conflict-remotestub is renumbered.Verified:
make -C lib/go/test checkpasses.