You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jamil (JIRA)" <ji...@apache.org> on 2015/10/06 23:55:27 UTC

[jira] [Updated] (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 ]

Jamil updated THRIFT-3365:
--------------------------
    Labels: golang union  (was: )

> 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)