On Sat, Oct 15, 2016 at 5:52 PM, Justin Israel wrote: > > > On Sun, 16 Oct 2016, 8:17 AM Tong Sun wrote: > >> Hi, >> >> Need help again. >> >> I got everything tested out correctly, in https://github.com/suntong/ >> lang/blob/master/lang/Go/src/ds/PersistentData-GOB.go, but when I tried >> to apply it to my real case (more complicated data structure), it doesn't >> work any more. I've put my code at, >> >> http://gopkg.in/suntong/deduper.v1 >> i.e., https://github.com/suntong/deduper/tree/v1.2 >> >> Here is the relevant piece: >> >> mh := minhash.New(cfg.bands, cfg.rows, cfg.shingles) >> persistName := "mh.gob" >> RestoreState(persistName, mh) >> defer SaveState(persistName, mh) >> >> >> The same code works well in https://github.com/suntong/ >> lang/blob/master/lang/Go/src/ds/PersistentData-GOB.go, but in >> my deduper.v1, after the program is run, that "defer SaveState" should >> have saved something, but the mh.gob is still an empty file: >> >> $ ls -l mh.gob >> -rw-rw---- 1 tong tong *22* 2016-10-15 15:13 mh.gob >> >> What might be the cause? >> How to fix it? >> > > You don't seem to check for errors in your restore and save calls. How do > you know that your save is actually working? >
That's a good point, still not the true cause -- checking them will be a good practice, but will not solve the problem here, because the exact same code works in https://github.com/suntong/lang/blob/master/lang/Go/src/ds/PersistentData-GOB.go. I've verify from the code and result that the save *is* actually working. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.