type ReaderAndCloser … var ErrShortRead … var ErrExpectEOF … // NewExactReadCloser returns a ReadCloser that returns errors if the underlying // reader does not read back exactly the requested number of bytes. func NewExactReadCloser(rc io.ReadCloser, totalBytes int64) io.ReadCloser { … } type exactReadCloser … func (e *exactReadCloser) Read(p []byte) (int, error) { … } func (e *exactReadCloser) Close() error { … }