• Russ Cox's avatar
    io: guarantee err == nil for full reads in ReadFull and ReadAtLeast · 662ff542
    Russ Cox authored
    This is a backwards compatible API change that fixes broken code.
    
    In Go 1.0, ReadFull(r, buf) could return either len(buf), nil or len(buf), non-nil.
    Most code expects only the former, so do that and document the guarantee.
    
    Code that was correct before is still correct.
    Code that was incorrect before, by assuming the guarantee, is now correct too.
    
    The same applies to ReadAtLeast.
    
    Fixes #4544.
    
    R=golang-dev, bradfitz, minux.ma
    CC=golang-dev
    https://golang.org/cl/7235074
    662ff542
io_test.go 6.61 KB