xStrom/goon — pull request #4 by mzimmerman (2014-06-04 01:10:29+00:00)
Title: Failing serialization

I found another problem with the serialization code. If I don't code TestSerialization as a concurrent test, then there's no issue, but as soon as you add the concurrency it fails in one of two ways.

`goon_test.go:2686: error deserializing - goon: Failed to decode field Played - extra data in buffer`
`goon_test.go:2731: error deserializing - goon: Failed to decode field Played - gob: decoding into local type [4]goon.Card, received remote type [4]int`

I've looked over the (get/free)serialization(de/en)coder() functions and they look correct, but If I comment out the List usage and just recreate the gob (en/de)coder, it works with no bugs. From reading the gob package docs, I'm unsure of exactly what the issue is, but it doesn't seem the gob package was intended to be re-used the way goon is doing it.

go test -test.run Serialization

Sorry for the large test code, it's been ~4 hours and I haven't been able to figure out exactly what the problem is in the test code but I have figured out how to reproduce it at least.