正常步骤:
安装golang的Thrift包:
go get /thrift.git/lib/go/thrift
安装 Thrift 的 IDL 编译工具:
/dyn/closer.cgi?path=/thrift/0.10.0/thrift-0.10.0.exe
编译客户端的时候会报错,出现not enough arguments in call to oprot.WriteMessageBegin的错误,这是因为本地生成协议的版本是与 go get /thrift.git/lib/go/thrift 下载下来的库版本是不同导致的。
可以先使用 Thrift 的 IDL 编译工具生成协议,然后进入/thrift.git目录,执行git checkout 0.10.0 然后重新编译即可。0.10.0就是对于IDL编译工具生成协议。
go语言使用thrift协议实现客户端和服务端报not enough arguments in call to oprot.WriteMessageBegin错误解决方案