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

import (
	"fmt"
	"strconv"
	"strings"

	"github.com/pelletier/go-toml/v2/internal/dang
    
func beforeLines(document []byte, offset int, linesAround int) [][]byte {
	var beforeLines [][]byte

	// Walk the document backward from the highlight to find previous lines
	// of context.
	rest := document[:offset]
backward:
	for o := len(rest) - 1; o >= 0 && len(beforeLines) <= linesAround && len(rest) > 0; {
		switch {
		case rest[o] == '\n':
			// handle individual lines
			beforeLines = append(beforeLines, rest[o+1:])
			rest = rest[:o]
			o = len(rest) - 1
		case o == 0:
			// add the first line only if it's non-empty
			beforeLines = append(beforeLines, rest)

			break backward
		default:
			o--
		}
	}

	return beforeLines
}