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

io: MultiReader's documentation is less precise than the changelog #53341

Closed
Jorropo opened this issue Jun 12, 2022 · 2 comments
Closed

io: MultiReader's documentation is less precise than the changelog #53341

Jorropo opened this issue Jun 12, 2022 · 2 comments
Labels
Documentation NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@Jorropo
Copy link
Member

Jorropo commented Jun 12, 2022

What version of Go are you using (go version)?

Go1.19-beta1

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
N/A

What did you do?

Open the 1.19 beta 1 changelog and go to the io section, then read:

MultiReader's result now implements WriterTo unconditionally. If any underlying reader does not implement WriterTo, it is simulated appropriately.

However the https://pkg.go.dev/io#MultiReader documentation does not include that:

// MultiReader returns a Reader that's the logical concatenation of
// the provided input readers. They're read sequentially. Once all
// inputs have returned EOF, Read will return EOF.  If any of the readers
// return a non-nil, non-EOF error, Read will return that error.

What did you expect to see?

A sentence including the WriterTo behaviour.

What did you see instead?

Nothing

Backstory

I didn't included a note of that while implementing WriterTo on MultiReader since I thought this was implementation details (I see WriterTo like an implicit optional extension of all Reader interfaces) and this is the behaviour you expect (you can find a youtube video where a member of the go team do a live codding session and talks about zero copying on multireaders which was not a thing back then).

If it is changelog worthy then it should be also documented in the code, so future developers can learn about it.

@Jorropo
Copy link
Member Author

Jorropo commented Jun 12, 2022

/cc @ianlancetaylor

@gopherbot
Copy link

Change https://go.dev/cl/411774 mentions this issue: io: document WriterTo behaviour on MultiReader

@thanm thanm added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jun 14, 2022
@seankhliao seankhliao added this to the Unreleased milestone Aug 20, 2022
@seankhliao seankhliao added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Aug 20, 2022
@Jorropo Jorropo closed this as not planned Won't fix, can't repro, duplicate, stale Aug 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants