[
https://issues.apache.org/jira/browse/THRIFT-3865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15351385#comment-15351385
]
Karl Mutch commented on THRIFT-3865:
------------------------------------
I have having issues replicating this problem using the go test framework in
the thrift code base. The reference tests using IncludesTest.thrift and
NamespacedTest.thrift with the compilation with the auto generated remotes
should run into this issue but they do not so I need help with replicating this
problem, or possibly it has already been corrected. The patch is below.
>From 9ca3b37f263f70ee0fc670d43ca350e45f847f64 Mon Sep 17 00:00:00 2001
From: Karl Mutch <[email protected]>
Date: Tue, 21 Jun 2016 15:37:25 -0700
Subject: [PATCH] Fix remote code generator issue with external packages to the
base Thrift IDL namespace
---
compiler/cpp/src/generate/t_go_generator.cc | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/compiler/cpp/src/generate/t_go_generator.cc
b/compiler/cpp/src/generate/t_go_generator.cc
index 6efff0e..5a02f16 100644
--- a/compiler/cpp/src/generate/t_go_generator.cc
+++ b/compiler/cpp/src/generate/t_go_generator.cc
@@ -2307,7 +2307,11 @@ void t_go_generator::generate_service_remote(t_service*
tservice) {
f_remote << indent() << " Usage()" << endl;
f_remote << indent() << " return" << endl;
f_remote << indent() << "}" << endl;
- f_remote << indent() << "argvalue" << i << " := " << package_name_ <<
"."
+ string module(module_name(the_type));
+ if (0 == strlen(module.c_str())) {
+ module = package_name_;
+ }
+ f_remote << indent() << "argvalue" << i << " := " << module << "."
<< publicize(the_type->get_name()) << "(tmp" << i << ")" <<
endl;
} else if (the_type2->is_base_type()) {
t_base_type::t_base e = ((t_base_type*)the_type2)->get_base();
--
2.9.0
> Go lang code generator enums do not select the correct package names
> --------------------------------------------------------------------
>
> Key: THRIFT-3865
> URL: https://issues.apache.org/jira/browse/THRIFT-3865
> Project: Thrift
> Issue Type: Bug
> Components: Go - Compiler
> Affects Versions: 0.9.3
> Environment: Found on Ubuntu 14.04 using Go lang 1.6.2. Present of
> all OS and Go versions
> Reporter: Karl Mutch
> Labels: easyfix
> Original Estimate: 4h
> Remaining Estimate: 4h
>
> When using thrift IDL include files that have different package names from
> the main thrift IDL file the code generator fails to use the correct package
> names for enums defined in the included file when they are referenced in the
> file doing the include and using the enum.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)