code: func (b *ByteBuf) ReadFrom(r io.Reader) (n int64, err error) {
  	for {
  		b.Expansion(minScale)
  		m, e := r.Read(b.buf[b.writerIndex : b.writerIndex+minScale])
  		if m < 0 {
  			panic("bug: negative Read")
  		}
  
  		b.writerIndex += m
  		n += int64(m)
  		if e == io.EOF {
  			return n, nil // e is EOF, so return nil explicitly
  		}
  		if e != nil {
  			return n, e
  		}
  
  		if m > 0 {
  			return n, e
  		}
  	}
  }
docs: // ReadFrom reads data from r until EOF and appends it to the buffer, growing
  // the buffer as needed. The return value n is the number of bytes read. Any
  // error except io.EOF encountered during the read is also returned. If the
  // buffer becomes too large, ReadFrom will panic with ErrTooLarge.