THRIFT-4285 Move TX/RX methods from gen. code to library
This change removes a lot of duplication from generated code and allows
the caller to customize how they can read from / write to the
transport. Backwards compatible adapters make the change compatible
with existing code in use by consuming applications.
Client: Go
This closes #1382
diff --git a/test/go/src/bin/testclient/main.go b/test/go/src/bin/testclient/main.go
index b34c539..ab24cbf 100644
--- a/test/go/src/bin/testclient/main.go
+++ b/test/go/src/bin/testclient/main.go
@@ -38,7 +38,7 @@
func main() {
flag.Parse()
- client, err := common.StartClient(*host, *port, *domain_socket, *transport, *protocol, *ssl)
+ client, _, err := common.StartClient(*host, *port, *domain_socket, *transport, *protocol, *ssl)
if err != nil {
t.Fatalf("Unable to start client: ", err)
}
@@ -128,7 +128,7 @@
}
bin, err := client.TestBinary(defaultCtx, binout)
for i := 0; i < 256; i++ {
- if (binout[i] != bin[i]) {
+ if binout[i] != bin[i] {
t.Fatalf("Unexpected TestBinary() result expected %d, got %d ", binout[i], bin[i])
}
}
@@ -224,21 +224,21 @@
}
crazy := thrifttest.NewInsanity()
- crazy.UserMap = map[thrifttest.Numberz]thrifttest.UserId {
- thrifttest.Numberz_FIVE: 5,
+ crazy.UserMap = map[thrifttest.Numberz]thrifttest.UserId{
+ thrifttest.Numberz_FIVE: 5,
thrifttest.Numberz_EIGHT: 8,
}
truck1 := thrifttest.NewXtruct()
truck1.StringThing = "Goodbye4"
- truck1.ByteThing = 4;
- truck1.I32Thing = 4;
- truck1.I64Thing = 4;
+ truck1.ByteThing = 4
+ truck1.I32Thing = 4
+ truck1.I64Thing = 4
truck2 := thrifttest.NewXtruct()
truck2.StringThing = "Hello2"
- truck2.ByteThing = 2;
- truck2.I32Thing = 2;
- truck2.I64Thing = 2;
- crazy.Xtructs = []*thrifttest.Xtruct {
+ truck2.ByteThing = 2
+ truck2.I32Thing = 2
+ truck2.I64Thing = 2
+ crazy.Xtructs = []*thrifttest.Xtruct{
truck1,
truck2,
}
@@ -248,17 +248,17 @@
}
if !reflect.DeepEqual(crazy, insanity[1][2]) {
t.Fatalf("Unexpected TestInsanity() first result expected %#v, got %#v ",
- crazy,
- insanity[1][2])
+ crazy,
+ insanity[1][2])
}
if !reflect.DeepEqual(crazy, insanity[1][3]) {
t.Fatalf("Unexpected TestInsanity() second result expected %#v, got %#v ",
- crazy,
- insanity[1][3])
+ crazy,
+ insanity[1][3])
}
if len(insanity[2][6].UserMap) > 0 || len(insanity[2][6].Xtructs) > 0 {
t.Fatalf("Unexpected TestInsanity() non-empty result got %#v ",
- insanity[2][6])
+ insanity[2][6])
}
xxsret, err := client.TestMulti(defaultCtx, 42, 4242, 424242, map[int16]string{1: "blah", 2: "thing"}, thrifttest.Numberz_EIGHT, thrifttest.UserId(24))