uber / tchannel-go

Go implementation of a multiplexing and framing protocol for RPC calls
http://uber.github.io/tchannel/
MIT License
490 stars 84 forks source link

Error compiling generated code by thrift-gen #921

Open mlgupta opened 3 months ago

mlgupta commented 3 months ago

I am using v1.34.4. Here is what I am experiencing: 1) Have this simple thrift file:

namespace java com.dbsentry.goprojects.meeting

typedef i64 TimeStamp

enum ServiceErrorType {
    ERR_UNKNOWN_LOW=1
    ERR_INTERNAL
    ERR_NULL_REQUEST
    ERR_NO_ROOM_AVAILABLE
}

exception ServiceError {
    1: optional string message
    2: optional ServiceErrorType errorType
} (
    rpc.code = "INTERNAL"
)

struct MeetingRequest {
    1: required TimeStamp startTime
    2: required TimeStamp endTime
}

struct MeetingResponse {
    1: required string reservationId
    2: required string roomId
}

service Meeting {
    MeetingResponse scheduleMeeting(
        1: required MeetingRequest request
    ) throws (
        1: ServiceError serviceError
    )
}

2) Generated code using following command: $ ~/Downloads/tchannel-go-1.34.4/build/thrift-gen --generateThrift --inputFile idl/meeting.thrift --outputDir vendor 3) When I try to build my code, I get the following error:

manish@idefix server-tchannel % go build -o ../../bin/thrift-ex-server-tchan
# meeting
../../vendor/meeting/meeting.go:128:38: too many arguments in call to iprot.ReadStructBegin
    have ("context".Context)
    want ()
../../vendor/meeting/meeting.go:134:58: too many arguments in call to iprot.ReadFieldBegin
    have ("context".Context)
    want ()
../../vendor/meeting/meeting.go:146:35: too many arguments in call to iprot.Skip
    have ("context".Context, "github.com/uber/tchannel-go/thirdparty/github.com/apache/thrift/lib/go/thrift".TType)
    want ("github.com/uber/tchannel-go/thirdparty/github.com/apache/thrift/lib/go/thrift".TType)
../../vendor/meeting/meeting.go:264:45: undefined: thrift.TExceptionType
../../vendor/meeting/meeting.go:623:12: undefined: thrift.TClient
../../vendor/meeting/meeting.go:624:15: undefined: thrift.ResponseMeta
../../vendor/meeting/meeting.go:639:32: undefined: thrift.TClient
../../vendor/meeting/meeting.go:645:42: undefined: thrift.TClient
../../vendor/meeting/meeting.go:649:52: undefined: thrift.ResponseMeta
../../vendor/meeting/meeting.go:653:58: undefined: thrift.ResponseMeta
../../vendor/meeting/meeting.go:146:35: too many errors

As you can see the error is coming while trying to build the generated code.