[ 
https://issues.apache.org/jira/browse/THRIFT-3413?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jens Geyer updated THRIFT-3413:
-------------------------------
    Attachment: THRIFT-3413-Thrift-code-generation-bug-in-Go-when-ex.patch

> 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
>            Assignee: Jens Geyer
>             Fix For: 1.0
>
>         Attachments: 
> THRIFT-3413-Thrift-code-generation-bug-in-Go-when-ex.patch, 
> THRIFT-3413-Thrift-code-generation-bug-in-Go-when-ex.patch, base.thrift, 
> extended.thrift
>
>
> 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)

Reply via email to