func DebugAddress(addr string) RunOption {
	return optionSetter(func(opts *runConfig) {
		opts.debugAddr = addr
	})
}
DebugAddress configures a debug server bound to addr. This option is
currently only supported when executing in Singleton mode. It is intended to
be used for long-running stress tests.
package regtest
import (
	"bytes"
	"context"
	"fmt"
	"io"
	"io/ioutil"
	"net"
	"os"
	"path/filepath"
	"runtime/pprof"
	"strings"
	"sync"
	"testing"
	"time"
	exec "golang.org/x/sys/execabs"
	"github.com/govim/govim/cmd/govim/internal/golang_org_x_tools/jsonrpc2"
	"github.com/govim/govim/cmd/govim/internal/golang_org_x_tools/jsonrpc2/servertest"
	"github.com/govim/govim/cmd/govim/internal/golang_org_x_tools/lsp/cache"
	"github.com/govim/govim/cmd/govim/internal/golang_org_x_tools/lsp/debug"
	"github.com/govim/govim/cmd/govim/internal/golang_org_x_tools/lsp/fake"
	"github.com/govim/govim/cmd/govim/internal/golang_org_x_tools/lsp/lsprpc"
	"github.com/govim/govim/cmd/govim/internal/golang_org_x_tools/lsp/protocol"
	"github.com/govim/govim/cmd/govim/internal/golang_org_x_tools/lsp/source"
	"github.com/govim/govim/cmd/govim/internal/golang_org_x_tools/xcontext"
)
type Mode int
const (
	Singleton Mode = 1 << iota
	Forwarded
	SeparateProcess
	Experimental
)
type Runner struct {
	DefaultModes             Mode
	Timeout                  time.Duration
	GoplsPath                string
	PrintGoroutinesOnFailure bool
	TempDir                  string
	SkipCleanup              bool
	OptionsHook              func(*source.Options)
	mu        sync.Mutex
	ts        *servertest.TCPServer
	socketDir string
	closers []io.Closer
}
type runConfig struct {
	editor      fake.EditorConfig
	sandbox     fake.SandboxConfig
	modes       Mode
	timeout     time.Duration
	debugAddr   string
	skipLogs    bool
	skipHooks   bool
	optionsHook func(*source.Options)
}
func (r *Runner) defaultConfig() *runConfig {
	return &runConfig{
		modes:       r.DefaultModes,
		timeout:     r.Timeout,
		optionsHook: r.OptionsHook,
	}
}
type RunOption interface {
	set(*runConfig)
}
type optionSetter func(*runConfig)
func (f optionSetter) set(opts *runConfig) {
	f(opts)
}
func Timeout(d time.Duration) RunOption {
	return optionSetter(func(opts *runConfig) {
		opts.timeout = d
	})
}
func ProxyFiles(txt string) RunOption {
	return optionSetter(func(opts *runConfig) {
		opts.sandbox.ProxyFiles = fake.UnpackTxt(txt)
	})
}
func Modes(modes Mode) RunOption {
	return optionSetter(func(opts *runConfig) {
		opts.modes = modes
	})
}
func Options(hook func(*source.Options)) RunOption {
	return optionSetter(func(opts *runConfig) {
		old := opts.optionsHook
		opts.optionsHook = func(o *source.Options) {
			if old != nil {
				old(o)
			}
			hook(o)
		}
	})
}
func SendPID() RunOption {
	return optionSetter(func(opts *runConfig) {
		opts.editor.SendPID = true
	})
}
type EditorConfig fake.EditorConfig
func (c EditorConfig) set(opts *runConfig) {
	opts.editor = fake.EditorConfig(c)
}
func WorkspaceFolders(relFolders ...string) RunOption {
	if len(relFolders) == 0 {
		relFolders = []string{}
	}
	return optionSetter(func(opts *runConfig) {
		opts.editor.WorkspaceFolders = relFolders
	})
}
func InGOPATH() RunOption {
	return optionSetter(func(opts *runConfig) {
		opts.sandbox.InGoPath = true
	})
}