[ https://issues.apache.org/jira/browse/THRIFT-3413?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jens Geyer updated THRIFT-3413: ------------------------------- Description: Given the following 2 thrift simple thrift files {code:title=base.thrift} namespace go base /** Common context for a request containing information about the requester. */ struct RequestContext { /** ID */ 1:required i64 ID } exception WError { /** Identifying code for the error */ 1:i64 code, /** Descriptive error message */ 2:string message, } service BaseService { /** A simple ping to see if the service is alive */ void ping() throws (1:WError err) } {code} {code:title=extended.thrift} namespace go extended include "base.thrift" struct Extended { 1:required i64 ID } service ExtendedService extends base.BaseService{ /** Creates the requested Translation. Returns the representation of the created Translation with a generated ID and the userId attached. */ Extended createExtended(1:base.RequestContext rc, 2:Extended ex) throws (1:base.WError err) } {code} This is a very simple service extending another service. When using thrift (0.9.3, 1.0.0-dev both tested), there is an generation problem that requires fixing by hand. Running this for generation {code} thrift -r -gen go:package_prefix=github.com/myrepo/gen-go/ extended.thrift {code} if I then change directories and run a go build, I get the following error. {code} $> cd gen-go/extended/extended_service-remote $> go build # github.com/myrepo/gen-go/extended/extended_service-remote ./extended_service-remote.go:134: undefined: extended.NewRequestContext {code} This is easily reproducible with these steps. was: Given the following 2 thrift simple thrift files ----------------begin base.thrift -------------------- namespace go base /** Common context for a request containing information about the requester. */ struct RequestContext { /** ID */ 1:required i64 ID } exception WError { /** Identifying code for the error */ 1:i64 code, /** Descriptive error message */ 2:string message, } service BaseService { /** A simple ping to see if the service is alive */ void ping() throws (1:WError err) } ---------------end base.thrift--------------------- ---------------begin extended.thrift-------------------- namespace go extended include "base.thrift" struct Extended { 1:required i64 ID } service ExtendedService extends base.BaseService{ /** Creates the requested Translation. Returns the representation of the created Translation with a generated ID and the userId attached. */ Extended createExtended(1:base.RequestContext rc, 2:Extended ex) throws (1:base.WError err) } ---------------end extended.thrift-------------------- This is a very simple service extending another service. When using thrift (0.9.3, 1.0.0-dev both tested), there is an generation problem that requires fixing by hand. Running this for generation thrift -r -gen go:package_prefix=github.com/myrepo/gen-go/ extended.thrift if I then change directories and run a go build, I get the following error. $> cd gen-go/extended/extended_service-remote $> go build # github.com/myrepo/gen-go/extended/extended_service-remote ./extended_service-remote.go:134: undefined: extended.NewRequestContext This is easily reproducible with these steps. > Thrift code generation bug in Go when extending service > ------------------------------------------------------- > > Key: THRIFT-3413 > URL: https://issues.apache.org/jira/browse/THRIFT-3413 > Project: Thrift > Issue Type: Bug > Reporter: Ryan Seltzer > > Given the following 2 thrift simple thrift files > {code:title=base.thrift} > namespace go base > /** Common context for a request containing information about the requester. > */ > struct RequestContext { > /** ID */ > 1:required i64 ID > } > exception WError { > /** Identifying code for the error */ > 1:i64 code, > /** Descriptive error message */ > 2:string message, > } > service BaseService { > /** A simple ping to see if the service is alive */ > void ping() throws (1:WError err) > } > {code} > {code:title=extended.thrift} > namespace go extended > include "base.thrift" > struct Extended { > 1:required i64 ID > } > service ExtendedService extends base.BaseService{ > /** > Creates the requested Translation. Returns the representation of the > created Translation with a generated ID and the userId attached. > */ > Extended createExtended(1:base.RequestContext rc, 2:Extended ex) throws > (1:base.WError err) > } > {code} > This is a very simple service extending another service. When using thrift > (0.9.3, 1.0.0-dev both tested), there is an generation problem that requires > fixing by hand. > Running this for generation > {code} > thrift -r -gen go:package_prefix=github.com/myrepo/gen-go/ extended.thrift > {code} > if I then change directories and run a go build, I get the following error. > {code} > $> cd gen-go/extended/extended_service-remote > $> go build > # github.com/myrepo/gen-go/extended/extended_service-remote > ./extended_service-remote.go:134: undefined: extended.NewRequestContext > {code} > This is easily reproducible with these steps. -- This message was sent by Atlassian JIRA (v6.3.4#6332)