Skip to content

Commit

Permalink
THRIFT-4914: Fix name redeclaration bug in compiled go code
Browse files Browse the repository at this point in the history
Client: go

This fixes the bug reported in
apache#2315 (comment).
  • Loading branch information
fishy committed Feb 17, 2021
1 parent 36bd59f commit b5868ed
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions compiler/cpp/src/thrift/generate/t_go_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2170,13 +2170,14 @@ void t_go_generator::generate_service_client(t_service* tservice) {
}

if (!(*f_iter)->is_oneway()) {
std::string metaName = tmp("_meta");
std::string resultName = tmp("_result");
std::string resultType = publicize(method + "_result", true);
f_types_ << indent() << "var " << resultName << " " << resultType << endl;
f_types_ << indent() << "var meta thrift.ResponseMeta" << endl;
f_types_ << indent() << "meta, err = p.Client_().Call(ctx, \""
f_types_ << indent() << "var " << metaName << " thrift.ResponseMeta" << endl;
f_types_ << indent() << metaName << ", err = p.Client_().Call(ctx, \""
<< method << "\", &" << argsName << ", &" << resultName << ")" << endl;
f_types_ << indent() << "p.SetLastResponseMeta_(meta)" << endl;
f_types_ << indent() << "p.SetLastResponseMeta_(" << metaName << ")" << endl;
f_types_ << indent() << "if err != nil {" << endl;

indent_up();
Expand Down

0 comments on commit b5868ed

Please sign in to comment.