Win7 Environment, Golang Thrift Demo Code compilation does not pass

Source: Internet
Author: User
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.