var repos … // getRepo gets the requested repo, and skips the test if -short is set and // repo is not configured as a short repo. func getRepo(tb testing.TB, name string) *repo { … } type repo … // reusableDir return a reusable directory for benchmarking, or "". // // If the user specifies a directory, the test will create and populate it // on the first run an re-use it on subsequent runs. Otherwise it will // create, populate, and delete a temporary directory. func (r *repo) reusableDir() string { … } // getDir returns directory containing repo source code, creating it if // necessary. It is safe for concurrent use. func (r *repo) getDir() string { … } // sharedEnv returns a shared benchmark environment. It is safe for concurrent // use. // // Every call to sharedEnv uses the same editor and sandbox, as a means to // avoid reinitializing the editor for large repos. Calling repo.Close cleans // up the shared environment. // // Repos in the package-local Repos var are closed at the end of the test main // function. func (r *repo) sharedEnv(tb testing.TB) *Env { … } // newEnv returns a new Env connected to a new gopls process communicating // over stdin/stdout. It is safe for concurrent use. // // It is the caller's responsibility to call Close on the resulting Env when it // is no longer needed. func (r *repo) newEnv(tb testing.TB, config fake.EditorConfig, forOperation string, cpuProfile bool) *Env { … } // Close cleans up shared state referenced by the repo. func (r *repo) Close() error { … } // cleanup cleans up state that is shared across benchmark functions. func cleanup() error { … }