You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Can Celasun (JIRA)" <ji...@apache.org> on 2017/05/30 09:01:04 UTC

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

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

Can Celasun resolved THRIFT-3365.
---------------------------------
    Resolution: Cannot Reproduce

> 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.15#6346)