protocol := thrift.NewTBinaryProtocol(transport) fieldType := thrift.BOOL fieldID := 1 fieldName := "myBool" protocol.WriteFieldBegin(fieldName, fieldType, fieldID)
var protocol thrift.TProtocol // Assume protocol object already exists var fieldType thrift.TType = thrift.STRING var fieldID int16 = 2 var fieldName string = "myString" protocol.WriteFieldBegin(fieldName, fieldType, fieldID)In this example, we again create a new field using WriteFieldBegin, but this time it is a string field with tag number 2. The function takes the previously defined protocol object, as well as the other parameters, to output the binary representation of this field. Overall, the package library can be determined to be a Thrift implementation of the TProtocol in Go.