Yes, the way to think of the topic here is: first, write your own code to
decode the legacy format, then arrange the data in a struct of your design,
and *then* persist the struct or slice of structs using an encode/decode
mechanism of choice, such as gob, protobuf, json, etc.

Step one here is your present task. It is as easy or hard as the old format
makes it. This is made a little easier in Go by the standard library tools
for byte order decoding, hex decoding, etc.

Step two is trivial to implement but is a design decision worth investing
some thought.

Step three, where you were starting, will be effortless after #1 and 2.

On Mon, Mar 18, 2019 at 11:10 AM Kurtis Rader <kra...@skepticism.us> wrote:

> On Mon, Mar 18, 2019 at 10:00 AM R Srinivasan <s...@srin.me> wrote:
>
>> i am investigating the use of go+protobuf for reading binary files of a
>> legacy design.
>>
>
>> my intial attempts to define the data structures have hit a roadblock -
>> support for data types such as uint16, int16, uint8, int8. Is this an
>> inherent protobuf limitation or am i overlooking something.
>>
>
> The protobuf subsystem cannot be used to read/write arbitrary binary
> formats. Binary protobufs use a very efficient, compact, encoding that is
> architecture neutral. For example, int fields are encoded the same way
> regardless of whether your CPU is little or big endian.
>
> --
> Kurtis Rader
> Caretaker of the exceptional canines Junior and Hank
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
-- 

*Michael T. jonesmichael.jo...@gmail.com <michael.jo...@gmail.com>*

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to