What\'s the best way (completeness and performance) in Golang to serialize and deserialize a struct to string and vice versa?
for example, if I have this struct:
Serialization of a struct generally uses the encoding package. However, that will work for public fields only. If you also need to serialize private fields, see this answer as an alternative.
You have several encoding choices (binary, text, json as in this example for a struct, xml, etc.). For example, the project cupcake/rdb uses encoding/binary to implement parsing and encoding of the Redis RDB file format (a binary representation of the in-memory store).
Another example is guregu/rediscache, a small library for caching data in Redis.