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: util.go
    path of file: ./repos/golangci-lint/pkg/packages
    
    the code of the file until where you have to start completion: package packages

import (
	"fmt"
	"regexp"
	"strings"

	"golang.org/x/tools/go/packages"
)

// reFile matches a line who starts with path and position.
// ex: `/example/main.go:11:17: foobar`
var reFile = regexp.MustCompile(`^.+\.go:\d+:\d+: .+`)

func ExtractErrors(pkg *packages.Package) []packages.Error {
	errors := extractErrorsImpl(pkg, map[*packages.Package]bool{})
	if len(errors) == 0 {
		return errors
	}

	seenErrors := map[string]bool{}
	var uniqErrors []packages.Error
	for _, err := range errors {
		msg := stackCrusher(err.Error())
		if seenErrors[msg] {
			continue
		}

		if msg != err.Error() {
			continue
		}

		seenErrors[msg] = true

		uniqErrors = append(un
    
func ExtractErrors(pkg *packages.Package) []packages.Error {
	errors := extractErrorsImpl(pkg, map[*packages.Package]bool{})
	if len(errors) == 0 {
		return errors
	}

	seenErrors := map[string]bool{}
	var uniqErrors []packages.Error
	for _, err := range errors {
		msg := stackCrusher(err.Error())
		if seenErrors[msg] {
			continue
		}

		if msg != err.Error() {
			continue
		}

		seenErrors[msg] = true

		uniqErrors = append(uniqErrors, err)
	}

	if len(pkg.GoFiles) != 0 {
		// errors were extracted from deps and have at least one file in package
		for i := range uniqErrors {
			if _, parseErr := ParseErrorPosition(uniqErrors[i].Pos); parseErr == nil {
				continue
			}

			// change pos to local file to properly process it by processors (properly read line etc.)
			uniqErrors[i].Msg = fmt.Sprintf("%s: %s", uniqErrors[i].Pos, uniqErrors[i].Msg)
			uniqErrors[i].Pos = fmt.Sprintf("%s:1", pkg.GoFiles[0])
		}

		// some errors like "code in directory  expects import" don't have Pos, set it here
		for i := range uniqErrors {
			err := &uniqErrors[i]
			if err.Pos == "" {
				err.Pos = fmt.Sprintf("%s:1", pkg.GoFiles[0])
			}
		}
	}

	return uniqErrors
}