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: integration.go
    path of file: ./repos/go-critic/checkers/internal/linttest
    
    the code of the file until where you have to start completion: package linttest

import (
	"bytes"
	"fmt"
	"os"
	"os/exec"
	"path/filepath"
	"strings"
	"testing"

	"github.com/google/go-cmp/cmp"
)

// R
    
func (cfg *IntegrationTest) runTest(t *testing.T, gocritic, gopath string) {
	data, err := os.ReadFile("linttest.params")
	if err != nil {
		t.Fatalf("reading linter run params: %v", err)
	}

	// If several tests re-use a single golden file,
	// don't read it repeatedly, just re-use its contents.
	goldenDataCache := make(map[string]string)

	for i, line := range strings.Split(string(data), "\n") {
		if line == "" {
			continue
		}

		// The format is:
		//	runParams ... "|" goldenFile
		parts := strings.Split(line, "|")
		runParams := strings.Split(strings.TrimSpace(parts[0]), " ")
		goldenFile := strings.TrimSpace(parts[1])

		// Read from a golden file or contents cache.
		var want string
		if data, ok := goldenDataCache[goldenFile]; ok {
			want = data
		} else {
			data, err := os.ReadFile(goldenFile)
			if err != nil {
				t.Errorf("read golden file: %v", err)
			}
			want = string(bytes.TrimSpace(data))
			goldenDataCache[goldenFile] = want
		}

		// Get the actual execution output.
		cmd := exec.Command(gocritic, runParams...)
		cmd.Env = append([]string{}, os.Environ()...) // Copy parent env
		cmd.Env = append(cmd.Env,
			// Override GOPATH.
			"GOPATH="+gopath,
			"GO111MODULE=auto")

		out, err := cmd.CombinedOutput()
		out = bytes.TrimSpace(out)
		var have string
		if err != nil {
			// Error is prepended to the beginning.
			have = err.Error() + "\n" + string(out)
		} else {
			have = string(out)
		}

		// To get line-by-line diff, split is required.
		wantLines := strings.Split(want, "\n")
		haveLines := strings.Split(have, "\n")
		if diff := cmp.Diff(wantLines, haveLines); diff != "" {
			t.Errorf("linttest.params:%d: output mismatch:\n%s", i+1, diff)
			t.Logf("linter output was: %s\n", have)
		}
	}
}