Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
encoding/gob: document that Decode returns io.EOF at end of input #7033
Docs for gob.Decoder.Decode() should mention that io.EOF is returned when there's nothing more to decode. One of the examples could be extended to show how to handle that properly. Due to lack of this information, I had to write a test program to understand the behavior.
I don't find it surprising. If you feel like being condescending, then at least be factually correct wrt what I wrote. The behavior is perfectly logical once you know it but when I didn't know it, it wasn't obvious. Obviously. I don't have an explanation for my confusion. I know that I did experience it. Maybe I'm dumb. Or maybe you can't expect people to make mental connections between an EOF constant in io package and error returned from Decode(). Documentation is not meant to be a puzzle.
FWIW, I agree that it's nice to be explicit about what can be expected. It's not that "EOF at end of input" is surprising, it's that unless that fact is documented, you might not want to rely on it.
Labels changed: added release-go1.3maybe.
Owner changed to @robpike.
Status changed to Accepted.