THRIFT-3128 Go generated code produces name collisions between services
Client: Go
Patch: Adam Beberg
diff --git a/compiler/cpp/src/generate/t_go_generator.cc b/compiler/cpp/src/generate/t_go_generator.cc
index c949225..b6e39a1 100644
--- a/compiler/cpp/src/generate/t_go_generator.cc
+++ b/compiler/cpp/src/generate/t_go_generator.cc
@@ -471,6 +471,11 @@
}
}
+ // Avoid naming collisions with other services
+ if (is_args_or_result) {
+ prefix += publicize(service_name_);
+ }
+
return prefix + value2;
}
diff --git a/lib/go/test/NamesTest.thrift b/lib/go/test/NamesTest.thrift
index b59a5e0..e7e9563 100644
--- a/lib/go/test/NamesTest.thrift
+++ b/lib/go/test/NamesTest.thrift
@@ -18,5 +18,15 @@
#
struct NamesTest {
- 1: required string type
+ 1: required string type
+}
+
+service NameCollisionOne
+{
+ void blahBlah()
+}
+
+service NameCollisionTwo
+{
+ void blahBlah()
}