THRIFT-4797: Fix import collisions in Go
Client: go
This closes #1811.
diff --git a/lib/go/test/ConflictNamespaceServiceTest.thrift b/lib/go/test/ConflictNamespaceServiceTest.thrift
new file mode 100644
index 0000000..aade3d7
--- /dev/null
+++ b/lib/go/test/ConflictNamespaceServiceTest.thrift
@@ -0,0 +1,25 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+namespace go conflict.context
+
+include "ConflictNamespaceTestD.thrift"
+
+service ConflictService {
+ ConflictNamespaceTestD.ThingD thingFunc()
+}
diff --git a/lib/go/test/ConflictNamespaceTestA.thrift b/lib/go/test/ConflictNamespaceTestA.thrift
new file mode 100644
index 0000000..2749da9
--- /dev/null
+++ b/lib/go/test/ConflictNamespaceTestA.thrift
@@ -0,0 +1,23 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+namespace go conflicta.common
+
+struct ThingA {
+ 1: bool value
+}
diff --git a/lib/go/test/ConflictNamespaceTestB.thrift b/lib/go/test/ConflictNamespaceTestB.thrift
new file mode 100644
index 0000000..b1940ff
--- /dev/null
+++ b/lib/go/test/ConflictNamespaceTestB.thrift
@@ -0,0 +1,23 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+namespace go conflictb.common
+
+struct ThingB {
+ 1: bool value
+}
diff --git a/lib/go/test/ConflictNamespaceTestC.thrift b/lib/go/test/ConflictNamespaceTestC.thrift
new file mode 100644
index 0000000..7d5ee25
--- /dev/null
+++ b/lib/go/test/ConflictNamespaceTestC.thrift
@@ -0,0 +1,23 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+namespace go common
+
+struct ThingC {
+ 1: bool value
+}
diff --git a/lib/go/test/ConflictNamespaceTestD.thrift b/lib/go/test/ConflictNamespaceTestD.thrift
new file mode 100644
index 0000000..8fe7f5e
--- /dev/null
+++ b/lib/go/test/ConflictNamespaceTestD.thrift
@@ -0,0 +1,23 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+namespace go conflictd.context
+
+struct ThingD {
+ 1: bool value
+}
diff --git a/lib/go/test/ConflictNamespaceTestSuperThing.thrift b/lib/go/test/ConflictNamespaceTestSuperThing.thrift
new file mode 100644
index 0000000..2348a62
--- /dev/null
+++ b/lib/go/test/ConflictNamespaceTestSuperThing.thrift
@@ -0,0 +1,29 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+include "ConflictNamespaceTestA.thrift"
+include "ConflictNamespaceTestB.thrift"
+include "ConflictNamespaceTestC.thrift"
+include "ConflictNamespaceTestD.thrift"
+
+struct SuperThing {
+ 1: ConflictNamespaceTestA.ThingA thing_a
+ 2: ConflictNamespaceTestB.ThingB thing_b
+ 3: ConflictNamespaceTestC.ThingC thing_c
+ 4: ConflictNamespaceTestD.ThingD thing_d
+}
diff --git a/lib/go/test/Makefile.am b/lib/go/test/Makefile.am
index 78d4681..244ddff 100644
--- a/lib/go/test/Makefile.am
+++ b/lib/go/test/Makefile.am
@@ -39,7 +39,13 @@
InitialismsTest.thrift \
DontExportRWTest.thrift \
dontexportrwtest/compile_test.go \
- IgnoreInitialismsTest.thrift
+ IgnoreInitialismsTest.thrift \
+ ConflictNamespaceTestA.thrift \
+ ConflictNamespaceTestB.thrift \
+ ConflictNamespaceTestC.thrift \
+ ConflictNamespaceTestD.thrift \
+ ConflictNamespaceTestSuperThing.thrift \
+ ConflictNamespaceServiceTest.thrift
mkdir -p gopath/src
grep -v list.*map.*list.*map $(THRIFTTEST) | grep -v 'set<Insanity>' > ThriftTest.thrift
$(THRIFT) $(THRIFTARGS) -r IncludesTest.thrift
@@ -59,6 +65,12 @@
$(THRIFT) $(THRIFTARGS) InitialismsTest.thrift
$(THRIFT) $(THRIFTARGS),read_write_private DontExportRWTest.thrift
$(THRIFT) $(THRIFTARGS),ignore_initialisms IgnoreInitialismsTest.thrift
+ $(THRIFT) $(THRIFTARGS) ConflictNamespaceTestA.thrift
+ $(THRIFT) $(THRIFTARGS) ConflictNamespaceTestB.thrift
+ $(THRIFT) $(THRIFTARGS) ConflictNamespaceTestC.thrift
+ $(THRIFT) $(THRIFTARGS) ConflictNamespaceTestD.thrift
+ $(THRIFT) $(THRIFTARGS) ConflictNamespaceTestSuperThing.thrift
+ $(THRIFT) $(THRIFTARGS) ConflictNamespaceServiceTest.thrift
GOPATH=`pwd`/gopath $(GO) get github.com/golang/mock/gomock || true
sed -i 's/\"context\"/\"golang.org\/x\/net\/context\"/g' gopath/src/github.com/golang/mock/gomock/controller.go || true
GOPATH=`pwd`/gopath $(GO) get github.com/golang/mock/gomock
@@ -79,7 +91,9 @@
initialismstest \
dontexportrwtest \
ignoreinitialismstest \
- unionbinarytest
+ unionbinarytest \
+ conflictnamespacetestsuperthing \
+ conflict/context/conflict_service-remote
GOPATH=`pwd`/gopath $(GO) test thrift tests dontexportrwtest
clean-local:
@@ -108,4 +122,10 @@
NamesTest.thrift \
InitialismsTest.thrift \
DontExportRWTest.thrift \
- IgnoreInitialismsTest.thrift
+ IgnoreInitialismsTest.thrift \
+ ConflictNamespaceTestA.thrift \
+ ConflictNamespaceTestB.thrift \
+ ConflictNamespaceTestC.thrift \
+ ConflictNamespaceTestD.thrift \
+ ConflictNamespaceTestSuperThing.thrift
+ ConflictNamespaceServiceTest.thrift