It turns out that the output bytes for proto3 are different from those for 
proto2. I fix it now.

在2020年7月17日星期五 UTC+8 下午5:05:20<Chan Lewis> 写道:

> Let's say I have a message:
>
> ```
> message Meta {
>   string a = 1;
>   int64 b= 2;
> }
> ```
>
> Somebody serializes the message with C++ like this:
>
> ```cpp
> Meta meta;
>
> char header_and_meta[meta_size];
> ::google::protobuf::io::ArrayOutputStream arr_out(header_and_meta, 
> meta_size);
> ::google::protobuf::io::CodedOutputStream coded_out(&arr_out);
> meta.SerializeWithCachedSizes(&coded_out);
>  ```
>
> Now I need to translate above code to golang equivalent code, but I don't 
> see equivalent struct in golang. I use *proto.Marshal(meta)*, but the 
> result of type []byte, is not totally same as data within 
> *header_and_meta*
>
> Anything wrong ?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/5dc53f24-74c9-400b-ad7e-c4090e7ad75fn%40googlegroups.com.

Reply via email to