Go: Reading and writing compressed gob to file -


This does not work properly and I'm not sure what I'm doing wrong I changed the map to Gabby Trying to do this, after binary left and save it in the file, read it later. Type object string {mystruct map [string] [] scorer} counter type type {class integer score float64} function (t * object) load (file name string) error {fi, hey: = Os.Open (filename) if deferred = zero {return_} deferred fi.Close () FZ, hey = gzip.NewReader (Internet) defaults = zero {returning}, then fz.Close ( ) Decoder:! = Gob.NewDecoder (FZ) error = decoder.Decode (& amp; t.mystruct) Error = FILE: Error: {=} {return}} return zero} function (T * object) Os.Create (filename) = invalid {return un-if} deferred fi.Close () FZ: = gzip.NewWriter (Internet) fz.Close () encoder suspended: = gob.NewEncoder (FZ) num = encoder. Encode (t.mystruct) if an = zero {return} return zero}

some is saved in a file and gzip appears to be valid, but It's not saving anything either It does not load back.

I am not sure if I am doing this right as if I am new to go and I am having difficulty getting my head around readers and writers, because I am using PHP Coming from and not using it

Any thoughts?

"itemprop =" text ">

Your problem is nothing what to do with readers and authors: You can not just encode / decode fields that are exported un - and all your fields are unzipped (lowercase). As explained in you use Mystruct , category and scores using your own BinaryMarshal / BinaryUnmarshal Or write to

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -