Skip to content

Instantly share code, notes, and snippets.

@paulsc
Created December 25, 2018 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulsc/ca9e5437cd784cf81b2b18c1f0321ea7 to your computer and use it in GitHub Desktop.
Save paulsc/ca9e5437cd784cf81b2b18c1f0321ea7 to your computer and use it in GitHub Desktop.
type FullBufferReader struct{ reader *io.Reader }
func (br *FullBufferReader) Read(p []byte) (int, error) {
n, err := io.ReadFull(*br.reader, p)
if err != nil {
if err == io.ErrUnexpectedEOF {
return n, io.EOF
} else {
return n, err
}
}
return n, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment