Github user davinchia commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/1311#discussion_r129124617
  
    --- Diff: compiler/cpp/src/thrift/generate/t_go_generator.cc ---
    @@ -424,6 +424,52 @@ bool t_go_generator::is_pointer_field(t_field* tfield, 
bool in_container_value)
       throw "INVALID TYPE IN type_to_go_type: " + type->get_name();
     }
     
    +string t_go_generator::gen_opt_const_values_(t_base_type::t_base tbase, 
t_const_value *value) {
    +  string go_value_str = "&(&struct{x ";
    +  switch (tbase) {
    +    case t_base_type::TYPE_BOOL:
    +      go_value_str += "bool}{";
    +      go_value_str += (value->get_integer() > 0 ? "true" : "false");
    +      break;
    +
    +    case t_base_type::TYPE_I8:
    +      go_value_str += "int8}{";
    +      go_value_str += std::to_string(static_cast<long 
long>(value->get_integer()));
    +      break;
    --- End diff --
    
    a) The casts are to avoid the `ambiguous calls` errors I was seeing on the 
integration tests.
    b) c) I separated the methods as I had mini unit tests on my machine. I 
left it this way since I felt the main method was getting slightly too long. 
Combining both methods will remove the casting problem and I have no strong 
opinions so I will do that instead. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to