import "github.com/apache/thrift/lib/go/thrift" 不能够resolve的问题
Closed this issue · 2 comments
wusyaname commented
在终端执行 thriftgo -g go 之后,生成了相应的go文件,但是"github.com/apache/thrift/lib/go/thrift"报错,can‘t resolve ,不知道什么原因。在kitex的测试example中不会出现这个问题。
package api
import (
"context"
"fmt"
"github.com/apache/thrift/lib/go/thrift"
)
补充一下:
用thrift -r --gen go tutorial.thrift命令生成的go文件如下:
func (p *Request) Read(ctx context.Context, iprot thrift.TProtocol) error {
if _, err := iprot.ReadStructBegin(ctx); err != nil {
return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
}
...
用thriftgo -g go tutorial.thrift 命令生成的go文件如下:
func (p *Request) Read(iprot thrift.TProtocol) (err error) {
var fieldTypeId thrift.TType
var fieldId int16
if _, err = iprot.ReadStructBegin(); err != nil {
goto ReadStructBeginError
}
...
后者在ReadStructBegin()缺少参数,编译器报错,很多函数函数调用都有这个问题,不知道如何解决。
HeyJavaBean commented
wusyaname commented
谢谢已经解决