[
https://issues.apache.org/jira/browse/THRIFT-3365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16029189#comment-16029189
]
Can Celasun commented on THRIFT-3365:
-------------------------------------
This is no longer valid as it works as expected. See
[here|https://github.com/dcelasun/misc/tree/master/thrift/THRIFT-3365] for
example code.
> 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)