THRIFT-2175 Wrong field type set for binary
authorJens Geyer <jensg@apache.org>
Tue, 10 Sep 2013 19:33:17 +0000 (21:33 +0200)
committerJens Geyer <jensg@apache.org>
Tue, 10 Sep 2013 19:34:43 +0000 (21:34 +0200)
Patch: Jens Geyer

compiler/cpp/src/generate/t_go_generator.cc
lib/go/thrift/serializer_types.go

index 24af687..00af893 100644 (file)
@@ -3129,10 +3129,11 @@ string t_go_generator::type_to_enum(t_type* type)
             throw "NO T_VOID CONSTRUCT";
 
         case t_base_type::TYPE_STRING:
+            /* this is wrong, binary is still a string type internally
             if (((t_base_type*)type)->is_binary()) {
                 return "thrift.BINARY";
             }
-
+            */
             return "thrift.STRING";
 
         case t_base_type::TYPE_BOOL:
index 2ce353b..8416b85 100644 (file)
@@ -470,7 +470,7 @@ func (p *TestStruct) writeField7(oprot TProtocol) (err error) {
 
 func (p *TestStruct) writeField8(oprot TProtocol) (err error) {
        if p.Bin != nil {
-               if err := oprot.WriteFieldBegin("bin", BINARY, 8); err != nil {
+               if err := oprot.WriteFieldBegin("bin", STRING, 8); err != nil {
                        return fmt.Errorf("%T write field begin error 8:bin: %s", p, err)
                }
                if err := oprot.WriteBinary(p.Bin); err != nil {