Is gob.Register needed?
Opened this issue · 5 comments
I am just wondering if there is a case when gob.Register is needed on the following lines:
https://github.com/mjibson/goon/blob/master/entity.go#L31
https://github.com/mjibson/goon/blob/master/entity.go#L41
Remove those lines and run goread. If it still works then we can remove them. I don't remember why I added them. Oh, there's also a test suite now. That would probably yield a similar result.
Seems to work with the gob.Register
lines commented out. Impressive app BTW. I am not going to generate a pull request yet. Someone that knows the goread app should test it properly. Adding some unit tests would probably be more robust.
There are unit tests. Look at goon_test.go
. I think you can run goapp test
in the goon directory and it'll run them. In any case I'll look again at the Register stuff.
The unit tests work fine with the lines removed. However I envisage that if there were going to be any problems they will be with datastore entity structs that have another struct as one of their properties. We can easily test this but don't know enough about the gob package to be certain there might be no other situations.
I don't think it is required. I cannot find a test case where it fails when the statement is removed. From reading the gob package documentation, we don't need to use it since goon only supports storing *structs, not *structs and PropertyLoadSavers (like the datastore).
In #24 in order to fix fetching _[]_struct and *[]struct, I got a panic when calling gob.Register, but I'm now unable to reproduce that.