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

Jack L commented on THRIFT-2189:
--------------------------------

When I filed this bug, the code that was generated was a valid structure, but 
not a valid union, which is different in thrift.

Can you post the go code you see generated for the test type?  For example, 
when I generate code with your test struct I get this:

type Test struct {
        Strong  string `thrift:"strong,1"`
        Integer int32  `thrift:"integer,2"`
        Truethy bool   `thrift:"truethy,3"`
}

There's nothing in this struct that tells go which of the union types was set, 
so it couldn't possibly be a valid union.  When I debugged this on the wire, it 
was sending it as a regular struct and not as a union.

If you generate the same code with java, the 'test' class stores not only the 
values of the three fields, but also which of the three is set, which allows it 
to be a valid union.

Do you see otherwise?  Does this make sense? 

> Go does not support "union" type
> --------------------------------
>
>                 Key: THRIFT-2189
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2189
>             Project: Thrift
>          Issue Type: Bug
>          Components: Go - Compiler
>            Reporter: Jack L
>             Fix For: 0.9.2
>
>
> Go thrift compiler does not support union types



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to