Search code examples
gogob

Example of using Gob in stream processing


Gob is good in space and performance efficiency when processing internally repeating data structure like big slice of struct or streamed data as documented. However I can't find a direct example after some searching.

Can anyone give or link to an example of how to use in a (possibly infinite) streamed input? (like a worker reading from a queue)


Solution

  • Dealing with stream is basically dealing with io.Writer/io.Reader. I share a snippet on go playground. Hope that helps. http://play.golang.org/p/_pzLtX-zc2