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: writer.go
    path of file: ./repos/marketstore/executor
    
    the code of the file until where you have to start completion: package executor

import (
	"errors"
	"fmt"
	stdio "io"
	"sort"
	"strings"
	"time"

	"github.com/klauspost/compress/snappy"

	"github.com/alpacahq/marketstore/v4/catalog"
	"githu
    
func formatRecord(buf, row []byte, t time.Time, index, intervalsPerDay int64, isVariable bool) []byte {
	/*
		Incoming data records ALWAYS have the 8-byte Epoch column first
	*/
	row = row[8:] // Chop off the Epoch column
	if !isVariable {
		return row
	}
	/*
		[VariableLength record] append IntervalTicks since bucket time instead of Epoch
	*/
	var outBuf []byte
	buf = append(buf, row...)
	outBuf = buf
	outBuf = appendIntervalTicks(outBuf, t, index, intervalsPerDay)
	return outBuf
}