Commit 51b09190 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

io/ioutil: add a comment on why devNull is a ReaderFrom

... protects this optimization from future well-meaning
Gophers looking to delete unused code. :)

R=gri
CC=golang-dev
https://golang.org/cl/5165041
parent 807eb29f
......@@ -104,6 +104,10 @@ func NopCloser(r io.Reader) io.ReadCloser {
type devNull int
// devNull implements ReaderFrom as an optimization so io.Copy to
// ioutil.Discard can avoid doing unnecessary work.
var _ io.ReaderFrom = devNull(0)
func (devNull) Write(p []byte) (int, os.Error) {
return len(p), nil
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment