THRIFT-3467 Go Maps for Thrift Sets Should Have Values of Type struct{}
Client: Go
Patch: artem antonenko <sam901@yandex.ru>
This closes #976
diff --git a/test/go/src/common/clientserver_test.go b/test/go/src/common/clientserver_test.go
index 3b81423..2a9d5e9 100644
--- a/test/go/src/common/clientserver_test.go
+++ b/test/go/src/common/clientserver_test.go
@@ -105,7 +105,7 @@
handler.EXPECT().TestNest(&thrifttest.Xtruct2{StructThing: &thrifttest.Xtruct{StringThing: "thing", ByteThing: 42, I32Thing: 4242, I64Thing: 424242}}).Return(&thrifttest.Xtruct2{StructThing: &thrifttest.Xtruct{StringThing: "thing", ByteThing: 42, I32Thing: 4242, I64Thing: 424242}}, nil),
handler.EXPECT().TestMap(map[int32]int32{1: 2, 3: 4, 5: 42}).Return(map[int32]int32{1: 2, 3: 4, 5: 42}, nil),
handler.EXPECT().TestStringMap(map[string]string{"a": "2", "b": "blah", "some": "thing"}).Return(map[string]string{"a": "2", "b": "blah", "some": "thing"}, nil),
- handler.EXPECT().TestSet(map[int32]bool{1: true, 2: true, 42: true}).Return(map[int32]bool{1: true, 2: true, 42: true}, nil),
+ handler.EXPECT().TestSet(map[int32]struct{}{1: struct{}{}, 2: struct{}{}, 42: struct{}{}}).Return(map[int32]struct{}{1: struct{}{}, 2: struct{}{}, 42: struct{}{}}, nil),
handler.EXPECT().TestList([]int32{1, 2, 42}).Return([]int32{1, 2, 42}, nil),
handler.EXPECT().TestEnum(thrifttest.Numberz_TWO).Return(thrifttest.Numberz_TWO, nil),
handler.EXPECT().TestTypedef(thrifttest.UserId(42)).Return(thrifttest.UserId(42), nil),
@@ -222,7 +222,7 @@
t.Errorf("Unexpected TestStringMap() result expected %#v, got %#v ", sm, smret)
}
- s := map[int32]bool{1: true, 2: true, 42: true}
+ s := map[int32]struct{}{1: struct{}{}, 2: struct{}{}, 42: struct{}{}}
sret, err := client.TestSet(s)
if err != nil {
t.Errorf("Unexpected error in TestSet() call: ", err)
diff --git a/test/go/src/common/mock_handler.go b/test/go/src/common/mock_handler.go
index 7495fc6..6ae8130 100644
--- a/test/go/src/common/mock_handler.go
+++ b/test/go/src/common/mock_handler.go
@@ -223,9 +223,9 @@
return _mr.mock.ctrl.RecordCall(_mr.mock, "TestOneway", arg0)
}
-func (_m *MockThriftTest) TestSet(_param0 map[int32]bool) (map[int32]bool, error) {
+func (_m *MockThriftTest) TestSet(_param0 map[int32]struct{}) (map[int32]struct{}, error) {
ret := _m.ctrl.Call(_m, "TestSet", _param0)
- ret0, _ := ret[0].(map[int32]bool)
+ ret0, _ := ret[0].(map[int32]struct{})
ret1, _ := ret[1].(error)
return ret0, ret1
}
diff --git a/test/go/src/common/printing_handler.go b/test/go/src/common/printing_handler.go
index 5fe3d53..afee8da 100644
--- a/test/go/src/common/printing_handler.go
+++ b/test/go/src/common/printing_handler.go
@@ -188,7 +188,7 @@
//
// Parameters:
// - Thing
-func (p *printingHandler) TestSet(thing map[int32]bool) (r map[int32]bool, err error) {
+func (p *printingHandler) TestSet(thing map[int32]struct{}) (r map[int32]struct{}, err error) {
fmt.Printf("testSet({")
first := true
for k, _ := range thing {
diff --git a/test/go/src/common/simple_handler.go b/test/go/src/common/simple_handler.go
index 944f11c..7bd3a30 100644
--- a/test/go/src/common/simple_handler.go
+++ b/test/go/src/common/simple_handler.go
@@ -77,7 +77,7 @@
return thing, nil
}
-func (p *simpleHandler) TestSet(thing map[int32]bool) (r map[int32]bool, err error) {
+func (p *simpleHandler) TestSet(thing map[int32]struct{}) (r map[int32]struct{}, err error) {
return thing, nil
}