Skip to content

bufio: stale documentation on Read, can call underlying reader more than once #12237

@kr

Description

@kr

Go version: tip.

The documentation for Read says

It calls Read at most once on the underlying Reader, hence n may be less than len(p).

but Read calls fill, and fill calls the underlying reader up to maxConsecutiveEmptyReads (100) times.

I realize the point of this is actually to say that n may be less than len(p), because Read stops after it gets one block of data (rather than continuing to read more data to fill p, as one might assume). The "no progress" case is unusual, and it generally doesn't matter to the caller, but if the user is supplying the underlying reader, this statement might be misleading.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions