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/tutorial/go/src/client.go b/tutorial/go/src/client.go
index 65027ea..25616bf 100644
--- a/tutorial/go/src/client.go
+++ b/tutorial/go/src/client.go
@@ -22,8 +22,9 @@
import (
"crypto/tls"
"fmt"
- "git.apache.org/thrift.git/lib/go/thrift"
"tutorial"
+
+ "git.apache.org/thrift.git/lib/go/thrift"
)
func handleClient(client *tutorial.CalculatorClient) (err error) {
@@ -98,5 +99,7 @@
if err := transport.Open(); err != nil {
return err
}
- return handleClient(tutorial.NewCalculatorClientFactory(transport, protocolFactory))
+ iprot := protocolFactory.GetProtocol(transport)
+ oprot := protocolFactory.GetProtocol(transport)
+ return handleClient(tutorial.NewCalculatorClient(thrift.NewTStandardClient(iprot, oprot)))
}