Connor Gorman created THRIFT-3700:
-------------------------------------

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


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



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to