fishy commented on code in PR #3971:
URL: https://github.com/apache/thrift/pull/3971#discussion_r4212189697


##########
compiler/cpp/src/thrift/generate/t_go_generator.cc:
##########
@@ -457,6 +457,19 @@ void t_go_generator::init_generator() {
   package_dir_ = get_out_dir();
   last_const_block_ = 0;
 
+  // The -remote stub's main() declares these local variables. An imported 
package with one of
+  // these names would be shadowed by them, so reserve them before any import 
is rendered; such a
+  // package is then imported under an alias in every file of this program.
+  if (!skip_remote_) {
+    for (const char* local :
+         {"cfg",       "client",    "cmd",     "err",      "framed",          
"headers",
+          "host",      "httptrans", "iprot",   "m",        "oprot",           
"parsedUrl",
+          "parts",     "port",      "portStr", "protocol", "protocolFactory", 
"trans",
+          "urlString", "useHttp"}) {
+      package_identifiers_set_.insert(local);

Review Comment:
   also the hardcoded list here doesn't seem maintainable, like it's easy to 
get out of sync with the actual local variables used in `main` inside 
`-remote`, but that part haven't changed in a long time though.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to