尝试给切片buf设置一个大小,例如
buf := make([]byte,128);
读取器最多读取给定缓冲区的len()。
来自io.go
// Reader is the interface that wraps the basic Read method.//// Read reads up to len(p) bytes into p. It returns the number of bytes// read (0 <= n <= len(p)) and any error encountered.// Even if Read returns n < len(p),// it may use all of p as scratch space during the call.// If some data is available but not len(p) bytes, Read conventionally// returns what is available rather than block waiting for more.//// At the end of the input stream, Read returns 0, os.EOF.// Read may return a non-zero number of bytes with a non-nil err.// In particular, a Read that exhausts the input may return n > 0, os.EOF.



