code: func ReadReq(r io.Reader) (requestKind int16, b []byte, err error) {
  	dec := NewDecoder(r)
  	msgSize := dec.DecodeInt32()
  	requestKind = dec.DecodeInt16()
  	if err := dec.Err(); err != nil {
  		return 0, nil, err
  	}
  	// size of the message + size of the message itself
  	b, err = allocParseBuf(int(msgSize + 4))
  	if err != nil {
  		return 0, nil, err
  	}
  
  	binary.BigEndian.PutUint32(b, uint32(msgSize))
  
  	// only write back requestKind if it was included in messageSize
  	if len(b) >= 6 {
  		binary.BigEndian.PutUint16(b[4:], uint16(requestKind))
  	}
  
  	// read rest of request into allocated buffer if we allocated for it
  	if len(b) > 6 {
  		if _, err := io.ReadFull(r, b[6:]); err != nil {
  			return 0, nil, err
  		}
  	}
  
  	return requestKind, b, nil
  }
docs: // ReadReq returns request kind ID and byte representation of the whole message
  // in wire protocol format.