What a thorn the design of that Read method is, because it has caused perennial FUD against the validity of sum typing in Go circles.
Re:Next steps toward Go 2
by atombender on Wednesday June 26, 2019 @06:58PM
(#20290140)
Has it come up a lot in Go proposals discussions?
io.Reader is an example where the function can return io.EOF and still returns valid data together with a count in its first return value. If it returns a count > 0, the buffer has valid data. A lot of Go projects get this wrong because it's not obvious -- it goes against the behaviour of almost all Go functions.
Go is unfortunately full of little surprising warts like this where you have to tread super carefully. Nil channels is one of my favorites.