Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReadAt does not have io.ReaderAt behavior #19

Closed
ashishgandhi opened this issue Nov 22, 2015 · 0 comments
Closed

ReadAt does not have io.ReaderAt behavior #19

ashishgandhi opened this issue Nov 22, 2015 · 0 comments

Comments

@ashishgandhi
Copy link
Contributor

According to the io.ReaderAt documentation (https://golang.org/pkg/io/#ReaderAt). For the signature

ReadAt(p []byte, off int64) (n int, err error)

“ReadAt reads len(p) bytes into p starting at offset off in the underlying input source. It returns the number of bytes read (0 <= n <= len(p)) and any error encountered.

When ReadAt returns n < len(p), it returns a non-nil error explaining why more bytes were not returned. In this respect, ReadAt is stricter than Read.”

If you simply try playing with a file you'd quickly observe that this is not followed. Taking a real world example I have a file of size 280689401. I pass in p of length 227743. But only 214 bytes are read. And the err is nil.

@ashishgandhi ashishgandhi changed the title io.ReaderAt has incorrect behavior ReadAt does not have io.ReaderAt behavior Nov 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant