Artificial intelligent assistant

無限に2バイトを返すio.Readerからio.CopyNで奇数バイトをコピーするとpanic 2`io.Reader`5`io.CopyN`panic package main import ( "io" "os" ) type stream int func (s *stream) Read(p []byte) (n int, err error) { p[0] = byte('a') p[1] = byte('b') return 2, nil } func main() { io.CopyN(os.Stdout, new(stream), 5) // panic: runtime error: index out of range } go version go1.10.3 windows/386

metropolis

`io.CopyN` `io.Reader` `io.LimitedReader` `io.Copy`

`io.LimitedReader` `io.Reader` read

* read52
* read32
* read1



read1`p[1]` `index out of range`

`p`

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 6432d373ec687cc10b8bbcb55731aab4