-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.help wantedrelease-blocker
Milestone
Description
If an error occurs writing to a Writer, no more data will be accepted and all subsequent writes, and Flush, will return the error.
type writer struct{}
func (w writer) Write(p []byte) (n int, err error) {
return 0, errors.New("bad move")
}
func main() {
var wr = bufio.NewWriter(writer{})
wr.WriteString("test1") // 5 <nil>
wr.Flush() // bad move
wr.ReadFrom(strings.NewReader("test2")) // 5 <nil>
wr.Buffered() // 10
}https://play.golang.org/p/--WBbDHbIS9
no more data will be accepted
Then I would expect ReadFrom to fail and the Buffered() count not to grow.
all subsequent writes [...] will return the error.
Isn't ReadFrom a write?
This seems unlikely to have bad consequences, but I don't think it's a valid reason for the documentation to be incorrect about corner cases.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.help wantedrelease-blocker