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

ASF GitHub Bot commented on THRIFT-4011:
----------------------------------------

Github user Jens-G commented on the issue:

    https://github.com/apache/thrift/pull/1156
  
    ```
    src/common/clientserver_test.go:61: cannot use handler (type 
*MockThriftTest) as type thrifttest.ThriftTest in argument to GetServerParams:
        *MockThriftTest does not implement thrifttest.ThriftTest (wrong type 
for TestSet method)
                have TestSet(map[int32]struct {}) (map[int32]struct {}, error)
                want TestSet([]int32) ([]int32, error)
    src/common/clientserver_test.go:226: cannot use s (type map[int32]struct 
{}) as type []int32 in argument to client.TestSet
    FAIL        common [build failed]
    make[2]: *** [check] Error 2
    make[2]: Leaving directory `/thrift/src/test/go'
    make[1]: *** [check-recursive] Error 1
    make[1]: Leaving directory `/thrift/src/test'
    make: *** [check-recursive] Error 1
    
    ```


> Sets of Thrift structs generate Go code that can't be serialized to JSON
> ------------------------------------------------------------------------
>
>                 Key: THRIFT-4011
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4011
>             Project: Thrift
>          Issue Type: Bug
>          Components: Go - Compiler
>            Reporter: Can Celasun
>
> Consider the following structs:
> {code}
> struct Foo {
>   1: optional string foo
> }
> struct Bar {
>   1: optional set<Foo> foos
> }
> {code}
> This compiles into the following Go code:
> {code}
> type Bar struct {
>       Foos map[*Foo]struct{} `thrift:"foos,1" db:"foos" json:"foos,omitempty"`
> }
> {code}
> Even though the generated code has tags for JSON support, Bar can't be 
> serialized to JSON:
> {code}
> json: unsupported type: map[*Foo]struct {}
> {code}
> One solution would be to use slices, not maps, for Thrift sets. Thoughts?



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to