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: message_set.go
    path of file: ./repos/liftbridge/server/commitlog
    
    the code of the file until where you have to start completion: package commitlog

import (
	"bytes"
	"context"
	"encoding/binary"
	"fmt"
	"hash/crc32"

	"github.com/pkg/errors"
)

const (
	offsetPos       = 0
	timestampPos    = 8
	leaderEpochPos  = 16
	sizePos         = 24
	msgSetHeaderLen = 28
)

type messageSet []byte

func
    
func readMessage(ctx context.Context, reader contextReader, headersBuf []byte) (SerializedMessage, int64, int64, uint64, error) {
	if _, err := reader.Read(ctx, headersBuf); err != nil {
		return nil, 0, 0, 0, errors.Wrap(err, "failed to read message headers")
	}
	var (
		offset      = int64(encoding.Uint64(headersBuf[offsetPos:]))
		timestamp   = int64(encoding.Uint64(headersBuf[timestampPos:]))
		leaderEpoch = encoding.Uint64(headersBuf[leaderEpochPos:])
		size        = encoding.Uint32(headersBuf[sizePos:])
		buf         = make([]byte, int(size))
	)
	if _, err := reader.Read(ctx, buf); err != nil {
		return nil, 0, 0, 0, errors.Wrap(err, "failed to ready message payload")
	}
	m := SerializedMessage(buf)
	// Check the CRC on the message.
	crc := m.Crc()
	if c := crc32.Checksum(m[4:], crc32cTable); crc != c {
		// If the CRC doesn't match, data on disk is corrupted which means the
		// server is in an unrecoverable state.
		panic(fmt.Errorf("Read corrupted data, expected CRC: 0x%08x, got: 0x%08x", crc, c))
	}
	return m, offset, timestamp, leaderEpoch, nil
}