THRIFT-4797: Go import improvements
This change improves two problems in go code imports:
1. Always rename import the thrift package into "thrift", as we allow
the user to use a different library to replace the official one from
the compiler command line, this makes sure that in compiler generated
go code we can always blindly use "thrift.*".
2. We added auto rename import dedup in d9019fc5a4, but in that change
for system packages we always use the full import path as the dedup
identifier, so system package "database/sql/driver" would not be
detected as a conflict against a thrift go namespace of
"foo.bar.driver". Use the part after the last "/" in system packages
as the dedup identifier instead.
diff --git a/lib/go/test/ConflictNamespaceTestSuperThing.thrift b/lib/go/test/ConflictNamespaceTestSuperThing.thrift
index 2348a62..348d8fb 100644
--- a/lib/go/test/ConflictNamespaceTestSuperThing.thrift
+++ b/lib/go/test/ConflictNamespaceTestSuperThing.thrift
@@ -16,14 +16,26 @@
# specific language governing permissions and limitations
# under the License.
#
+namespace go conflict.super
+
include "ConflictNamespaceTestA.thrift"
include "ConflictNamespaceTestB.thrift"
include "ConflictNamespaceTestC.thrift"
include "ConflictNamespaceTestD.thrift"
+include "ConflictNamespaceTestE.thrift"
+include "ConflictNamespaceTestF.thrift"
struct SuperThing {
1: ConflictNamespaceTestA.ThingA thing_a
2: ConflictNamespaceTestB.ThingB thing_b
3: ConflictNamespaceTestC.ThingC thing_c
4: ConflictNamespaceTestD.ThingD thing_d
+ 5: ConflictNamespaceTestE.ThingE thing_e
+ 6: ConflictNamespaceTestF.ThingF thing_f
+}
+
+// Define an enum to force the import of database/sql/driver
+enum Enum {
+ One = 1
+ Two = 2
}