Encoding

Let's try to encode a structure using gob:

var char = Character{
Name: "Albert",
Surname: "Wilmarth",
Job: "assistant professor",
}
s := strings.Builder{}
e := gob.NewEncoder(&s)
if err := e.Encode(char); err != nil {
log.Fatalln(err)
}
log.Printf("%q", s.String())

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.66.156