Jamil created THRIFT-3365:
-----------------------------

             Summary: 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


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)

Reply via email to