This is a creation in Article, where the information may have evolved or changed.
With the official tutorial code: HTTP://THRIFT.APACHE.ORG/TUTORIAL/GO
User-Supplied code: Golang RPC Thrift
The following conditions are present
Condition 1:
The editor will alert cannot use ' processor ' (type *formatdataprocessor) as type Tprocessor
Condition 2:
# Thriftdemo/example
Example\example.go:232:cannot use Formatdataprocessordoformat literal (type *formatdataprocessordoformat) as type Thrift. Tprocessorfunction in Assignment:
*formatdataprocessordoformat does not implement thrift. Tprocessorfunction (wrong type for Process method)
Have Process (Int32, Thrift. Tprotocol, Thrift. TPROTOCOL) (bool, thrift. Texception)
Want Process (context. Context, Int32, Thrift. Tprotocol, Thrift. TPROTOCOL) (bool, thrift. Texception)
Example\example.go:240:not enough arguments in call to processor. Process
Have (Int32, Thrift. Tprotocol, Thrift. Tprotocol)
Want (context. Context, Int32, Thrift. Tprotocol, Thrift. Tprotocol)
Analysis Reason:
At first I thought it was related to the environment, I today in the company with Win7 + Go 1.9.1 (found official server code compiled, but from 1.8.0 upgrade) + Thrift 0.10.0 official demo and online demo how all compiled but server side, Client side no problem, just at home mac go 1.8.0 + thrift 0.10.0 The same code, no problem, but I ignore the other problem, thrift Lib Go file, the company is deleted today again, the home is a few months ago
Reason for speculation:
Thrift was installed a few months ago, and my recent go get git.apache.org/thrift.git/lib/go/thrift updated the code, resulting in inconsistent code versions
Solution:
Finally came to the conclusion that the thrift version and Git.apache.org/thrift.git/lib/go/thrift version inconsistency caused, today on the Win7 platform also ran, I directly in the Gopath environment
Delete the git.apache.org/thrift.git/directory first, and then
Mkdir-p Git.apache.org/thrift.git/lib/go/thrift
Finally, copy the code from the Thrift installation directory past, which can be
List of my thrift:
D:\thrift\src\thrift\lib\go\thrift