Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error compiling generated code by thrift-gen #921

Open
mlgupta opened this issue Aug 15, 2024 · 0 comments
Open

Error compiling generated code by thrift-gen #921

mlgupta opened this issue Aug 15, 2024 · 0 comments

Comments

@mlgupta
Copy link

mlgupta commented Aug 15, 2024

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
    )
}
  1. Generated code using following command:
    $ ~/Downloads/tchannel-go-1.34.4/build/thrift-gen --generateThrift --inputFile idl/meeting.thrift --outputDir vendor
  2. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant