Skip to content

os.File.ReadAt doc misleading #2486

@hanwen

Description

@hanwen
The doc for ReadAt is somewhat misleading: 

"ReadAt reads len(b) bytes from the File starting at byte offset off. It returns
the number of bytes read and the Error, if any. EOF is signaled by a zero count with err
set to EOF. ReadAt always returns a non-nil Error when n != len(b)."

when EOF is encountered during  a read, you can have a > 0 return value and EOF.  How
about simply saying:

"ReadAt reads len(b) bytes from the File starting at byte offset off. It returns
the number of bytes read and if n != len(b) an error. End of file is signaled by the EOF
error."

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions