compiler/cpp/src/generate/t_go_generator.cc
/** See the comment inside generate_go_struct_definition for what this is. */
See the comment inside generate_go_struct_definition for what this is.
See the comment inside generate_go_struct_definition for what this is .
string t_go_generator::type_to_spec_args(t_type* ttype) {
  while (ttype->is_typedef()) {
    ttype = ((t_typedef*)ttype)->get_type();
  }
  if (ttype->is_base_type() || ttype->is_enum()) {
    return "nil";
  } else if (ttype->is_struct() || ttype->is_xception()) {
    return "(" + type_name(ttype) + ", " + type_name(ttype) + ".thrift_spec)";
  } else if (ttype->is_map()) {
    return "(" +
      type_to_enum(((t_map*)ttype)->get_key_type()) + "," +
      type_to_spec_args(((t_map*)ttype)->get_key_type()) + "," +
      type_to_enum(((t_map*)ttype)->get_val_type()) + "," +
      type_to_spec_args(((t_map*)ttype)->get_val_type()) +
      ")";
  } else if (ttype->is_set()) {
    return "(" +
      type_to_enum(((t_set*)ttype)->get_elem_type()) + "," +
      type_to_spec_args(((t_set*)ttype)->get_elem_type()) +
      ")";
  } else if (ttype->is_list()) {
    return "(" +
      type_to_enum(((t_list*)ttype)->get_elem_type()) + "," +
      type_to_spec_args(((t_list*)ttype)->get_elem_type()) +
      ")";
  }
  throw "INVALID TYPE IN type_to_spec_args: " + ttype->get_name();
}
string t_go_generator :: type_to_spec_args ( t_type * ttype ) { while ( ttype -> is_typedef ( ) ) { ttype = ( ( t_typedef * ) ttype ) -> get_type ( ) ; } if ( ttype -> is_base_type ( ) || ttype -> is_enum ( ) ) { return " " ; } else if ( ttype -> is_struct ( ) || ttype -> is_xception ( ) ) { return " " + type_name ( ttype ) + " " + type_name ( ttype ) + " " ; } else if ( ttype -> is_map ( ) ) { return " " + type_to_enum ( ( ( t_map * ) ttype ) -> get_key_type ( ) ) + " " + type_to_spec_args ( ( ( t_map * ) ttype ) -> get_key_type ( ) ) + " " + type_to_enum ( ( ( t_map * ) ttype ) -> get_val_type ( ) ) + " " + type_to_spec_args ( ( ( t_map * ) ttype ) -> get_val_type ( ) ) + " " ; } else if ( ttype -> is_set ( ) ) { return " " + type_to_enum ( ( ( t_set * ) ttype ) -> get_elem_type ( ) ) + " " + type_to_spec_args ( ( ( t_set * ) ttype ) -> get_elem_type ( ) ) + " " ; } else if ( ttype -> is_list ( ) ) { return " " + type_to_enum ( ( ( t_list * ) ttype ) -> get_elem_type ( ) ) + " " + type_to_spec_args ( ( ( t_list * ) ttype ) -> get_elem_type ( ) ) + " " ; } throw " " + ttype -> get_name ( ) ; }
See the comment inside generate_go_struct_definition for what this is.
See the comment inside generate_go_struct_definition for what this is .