import ( "github.com/apache/thrift/lib/go/thrift" ) // create a transport transportFactory := thrift.NewTTransportFactory() transport, _ := thrift.NewTBufferedTransportFactory(8192).GetTransport(socket) // create a binary protocol protocolFactory := thrift.NewTBinaryProtocolFactoryDefault() // read from the transport using the binary protocol reader := protocolFactory.GetProtocol(transport) var result ResultStruct err := result.Read(reader)
import ( "github.com/apache/thrift/lib/go/thrift" ) // create a transport transportFactory := thrift.NewTTransportFactory() transport, _ := thrift.NewTBufferedTransportFactory(8192).GetTransport(socket) // create a json protocol protocolFactory := thrift.NewTJSONProtocolFactory() // read from the transport using the json protocol reader := protocolFactory.GetProtocol(transport) var result ResultStruct err := result.Read(reader)The package library for these examples is the Apache Thrift Go Library.