You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: byteslice.go
    path of file: ./repos/bytom/lib/github.com/tendermint/go-wire
    
    the code of the file until where you have to start completion: package wire

import (
	"io"
	"math"

	cmn "github.com/tendermint/tmlibs/common"
)

func WriteByteSlice
    
func ReadByteSlice(r io.Reader, lmt int, n *int, err *error) []byte {
	length := ReadVarint(r, n, err)
	if *err != nil {
		return nil
	}
	if length < 0 {
		*err = ErrBinaryReadInvalidLength
		return nil
	}

	// check that length is less than the maximum slice size
	if length > math.MaxInt32 {
		*err = ErrBinaryReadOverflow
		return nil
	}
	if lmt != 0 && lmt < cmn.MaxInt(length, *n+length) {
		*err = ErrBinaryReadOverflow
		return nil
	}

	/*	if length == 0 {
		return nil // zero value for []byte
	}*/

	buf := make([]byte, length)
	ReadFull(buf, r, n, err)
	return buf
}