[
https://issues.apache.org/jira/browse/THRIFT-4260?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16098176#comment-16098176
]
ASF GitHub Bot commented on THRIFT-4260:
----------------------------------------
GitHub user taozle reopened a pull request:
https://github.com/apache/thrift/pull/1312
Add context as first arg for client method.
Related: https://issues.apache.org/jira/browse/THRIFT-4260
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/taozle/thrift client-context
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/thrift/pull/1312.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1312
----
commit 202840379f99e5cdf786b1a4ac698b1cf40ede12
Author: taozle <[email protected]>
Date: 2017-07-23T13:21:44Z
Add context as first arg for client method.
commit 9ea932aac18735cdd0579b65b259a5b9162d5347
Author: taozle <[email protected]>
Date: 2017-07-23T17:44:28Z
Fix tests.
commit ab761b61a3b87affa5bead0d8ba662e2efdbafa3
Author: taozle <[email protected]>
Date: 2017-07-24T03:20:30Z
Fix tests.
----
> Go context generation issue. Context is parameter in Interface not in
> implementation
> ------------------------------------------------------------------------------------
>
> Key: THRIFT-4260
> URL: https://issues.apache.org/jira/browse/THRIFT-4260
> Project: Thrift
> Issue Type: Bug
> Components: Go - Compiler
> Affects Versions: 0.11.0
> Reporter: Bas van Beek
> Assignee: taozle
> Priority: Blocker
>
> Unfortunately the Go library was updated before a new Compiler was released.
> Having thrift compiled code be part in a project prior to the thrift context
> library addition breaks due to the dependency on the thrift go library. See:
> https://github.com/openzipkin/zipkin-go-opentracing/issues/68
> I tried to resolve be installing compiler from latest source but found the
> generated source to be incorrect. The generated Go interface for the service
> client includes context.Context as the first parameter of the service method.
> The generated client implementation however does not.
> The following thrift code:
> {code:none}
> enum ResultCode
> {
> OK,
> TRY_LATER
> }
> struct LogEntry
> {
> 1: string category,
> 2: string message
> }
> service Scribe
> {
> ResultCode Log(1: list<LogEntry> messages);
> }
> {code}
> Generated the following Go code:
> {code:none}
> type Scribe interface {
> // Parameters:
> // - Messages
> Log(ctx context.Context, messages []*LogEntry) (r ResultCode, err error)
> }
> ...
> // Parameters:
> // - Messages
> func (p *ScribeClient) Log(messages []*LogEntry) (r ResultCode, err error) {
> if err = p.sendLog(messages); err != nil {
> return
> }
> return p.recvLog()
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)