gob not decoding as expected

Here is my playground where I am trying to serialize a list of structures and read back from the file.


I was expecting the object to be decoded successfully. What am I doing wrong?

1 answer

  • answered 2018-02-13 00:54 Cerise Limón

    Export the field names by capitalizing the first letter.

    type REntry struct {
          Key         string
          Value       []string

    The gob package and other similar packages ignore unexported fields.