mirror of
https://github.com/golang/go
synced 2024-11-19 22:44:45 -07:00
io: document that a Writer must not write to p
Per golang-nuts question. Writing to p breaks other writers (e.g. io.MultiWriter). Make this explicit. LGTM=gri, r, rsc R=r, rsc, gri, joshlf13 CC=golang-codereviews https://golang.org/cl/87780046
This commit is contained in:
parent
44f96d4488
commit
a1ae3a0536
@ -74,6 +74,7 @@ type Reader interface {
|
|||||||
// It returns the number of bytes written from p (0 <= n <= len(p))
|
// It returns the number of bytes written from p (0 <= n <= len(p))
|
||||||
// and any error encountered that caused the write to stop early.
|
// and any error encountered that caused the write to stop early.
|
||||||
// Write must return a non-nil error if it returns n < len(p).
|
// Write must return a non-nil error if it returns n < len(p).
|
||||||
|
// Write must not modify the slice data, even temporarily.
|
||||||
type Writer interface {
|
type Writer interface {
|
||||||
Write(p []byte) (n int, err error)
|
Write(p []byte) (n int, err error)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user