Skip to content

Instantly share code, notes, and snippets.

@madosuki
Created November 13, 2018 11:03
Show Gist options
  • Save madosuki/60e9e3299285b040747bab0274974e1c to your computer and use it in GitHub Desktop.
Save madosuki/60e9e3299285b040747bab0274974e1c to your computer and use it in GitHub Desktop.
type Test struct {
name string
}
func main() {
var buf bytes.Buffer
enc := gob.NewEncoder(&buf)
dec := gob.NewDecoder(&buf)
err := enc.Encode(Test{"Cat"})
var dec_buf Test
err = dec.Deocde(&dec_buf)
fmt.Println(dec_buf.name)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment