transport := thrift.NewTMemoryBuffer() protocol := thrift.NewTBinaryProtocolTransport(transport) message := NewMyMessage() message.Read(protocol) protocol.ReadMessageEnd()
transport := thrift.NewTSocket("localhost:9090") transport.Open() protocol := thrift.NewTBinaryProtocolTransport(transport) message := NewMyMessage() message.Read(protocol) protocol.ReadMessageEnd() transport.Close()This code creates a new socket transport that connects to the server on localhost: 9090. It then opens the transport and creates a binary protocol transport that reads from the socket. A new message object is created and read from the transport using the protocol. The protocol's ReadMessageEnd() function is called to signal the end of the message. Finally, the transport is closed. Package Library: The package library is git.apache.org/thrift.git/lib/go/thrift.