You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jens Geyer (JIRA)" <ji...@apache.org> on 2015/10/07 09:51:28 UTC

[jira] [Commented] (THRIFT-3365) IDL Union structs nil dereferencing in Go

    [ https://issues.apache.org/jira/browse/THRIFT-3365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14946462#comment-14946462 ] 

Jens Geyer commented on THRIFT-3365:
------------------------------------

[~jseaidoun], 
any chance you could [provide a patch or PR|https://thrift.apache.org/docs/HowToContribute]?

> IDL Union structs nil dereferencing in Go
> -----------------------------------------
>
>                 Key: THRIFT-3365
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3365
>             Project: Thrift
>          Issue Type: Bug
>          Components: Go - Compiler
>    Affects Versions: 0.9.2
>            Reporter: Jamil
>              Labels: golang, union
>
> Suppose I have a union 
> {code}
> union Select {
>     1: Aggregate selectAggregate,
>     2: SelectColumns selectColumns,
> }
> {code}
> the Go representation looks like
> {code}
> type Select struct {
> 	SelectAggregate *Aggregate     `thrift:"selectAggregate,1" json:"selectAggregate"`
> 	SelectColumns   *SelectColumns `thrift:"selectColumns,2" json:"selectColumns"`
> }
> {code}
> now when I create 
> {code}
> Select = NewSelect()
> Select.SelectColumns = SelectColumns{
> ...
> }
> {code}
> I get a nil dereference pointer when the code tries to invoke 
> select.SelectAggregate.writeField1()
> however if I create a empty aggregate instantiation I get the error:
> Cannot read a TUnion with more than one set value!



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)