import ( "git.apache.org/thrift.git/lib/go/thrift" ) // Given a Thrift struct `foo` foo := &MyStruct{ MyInt64Field: 42, } // Create a binary Thrift protocol protocol := thrift.NewBinaryProtocol(transport) // Read the int64 field from the struct myInt64, err := protocol.ReadI64() if err != nil { // handle error }
import ( "bytes" "git.apache.org/thrift.git/lib/go/thrift" ) // Given a binary Thrift buffer `buf` buf := bytes.NewBuffer(someBinaryData) // Create a binary Thrift protocol transport := thrift.NewMemoryBufferLen(buf.Len()) protocol := thrift.NewBinaryProtocolTransport(transport) // Read the int64 from the buffer myInt64, err := protocol.ReadI64() if err != nil { // handle error }Package library: git.apache.org.thrift.git.lib.go.thrift