I follow this tutorial and got to the serialization / marshaling part of Go structs in the protocol buffer. My structure has a map, and I cannot find documentation on how to handle map marshaling.
Next, I want to serialize the Fields map[string]string :
Go struct:
type Note struct { ID NoteID Fields map[string]string }
protobuf circuit:
package internal; message Note { optional int64 ID = 1; optional map<string, string> Fields = 2; }
Go Marshal:
func MarshalNote(n *remember.Note) ([]byte, error) { return proto.Marshal(&Note{ ID: proto.Int64(int64(n.ID)) Fields: proto.??? }) }
I have no idea what to do for the last line, and anything Iโm looking for to talk about matching a field with a proto-buf, and not about matching a map with a proto-buf.
source share