title: In Go, how can I convert a struct to a byte array?
body: <p>I have an instance of a struct that I defined and I would like to convert it to an array of bytes. I tried []byte(my_struct), but that did not work. Also, I was pointed to the <a href="http://golang.org/pkg/encoding/binary/" rel="noreferrer">binary package</a>, but I am not sure which function I should use and how I should use it. An example would be greatly appreciated.</p>