IssueRaiser

proposal: io/v2: add Context parameter to Reader, etc.

Related to #18507, it would be nice if the `io` interface methods all took in `Context` as their first parameter. This allows a cancellation signal to be attached directly to the I/O calls that are using them, instead of requiring an out-of-band method, as in `net.Conn`. This is obviously a backward-incompatible change and would have broad impact on the ecosystem. I wanted to open this as a proposal for consideration in Go 2. **EDIT:** See [below](https://github.com/golang/go/issues/20280#issuecomment-320712428) for the more backward-compatible proposal **EDIT 2:** I've written an experience report/blog post detailing the background for this proposal: [Canceling I/O in Go Cap’n Proto](https://medium.com/@zombiezen/canceling-i-o-in-go-capn-proto-5ae8c09c5b29). Feedback and alternatives welcome.

Posted by zombiezen on May 8, 2017, 3:00 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.4,500 issues0 comments

github (Software)

proposal: io/v2: add Context parameter to Reader, etc.

zombiezenMay 8, 2017, 3:00 PM

Related to #18507, it would be nice if the `io` interface methods all took in `Context` as their first parameter. This allows a cancellation signal to be attached directly to the I/O calls that are using them, instead of requiring an out-of-band method, as in `net.Conn`. This is obviously a backward-incompatible change and would have broad impact on the ecosystem. I wanted to open this as a proposal for consideration in Go 2. **EDIT:** See [below](https://github.com/golang/go/issues/20280#issuecomment-320712428) for the more backward-compatible proposal **EDIT 2:** I've written an experience report/blog post detailing the background for this proposal: [Canceling I/O in Go Cap’n Proto](https://medium.com/@zombiezen/canceling-i-o-in-go-capn-proto-5ae8c09c5b29). Feedback and alternatives welcome.

Comments (0)

No comments yet. Start the discussion.

Comment on this issue