You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Can Celasun (JIRA)" <ji...@apache.org> on 2017/02/21 22:33:44 UTC

[jira] [Closed] (THRIFT-3700) Go Map has wrong default value when optional

     [ https://issues.apache.org/jira/browse/THRIFT-3700?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Can Celasun closed THRIFT-3700.
-------------------------------
       Resolution: Fixed
    Fix Version/s: 0.11.0

This is fixed by [THRIFT-4011|https://issues.apache.org/jira/browse/THRIFT-4011] since Thrift sets are now handled with slices.

> Go Map has wrong default value when optional
> --------------------------------------------
>
>                 Key: THRIFT-3700
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3700
>             Project: Thrift
>          Issue Type: Bug
>          Components: Go - Compiler
>    Affects Versions: 0.9.3
>            Reporter: Connor Gorman
>             Fix For: 0.11.0
>
>
> Template:
> {code}
> struct TaskQuery {
>     4: optional set<string> taskIds
> }
> {code}
> renders in Golang as :
> {code}
> TaskIds  map[string]bool         `thrift:"taskIds,4" json:"taskIds,omitempty"`
> {code}
> In Golang, the default value for a map is simply an empty map and not nil, but the optional check
> {code}
> func (p *TaskQuery) IsSetTaskIds() bool {
> 	return p.TaskIds != nil
> }
> {code} 
> checks against nil instead if an empty map



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