mirror of
https://github.com/golang/go
synced 2024-11-05 11:46:12 -07:00
416e8f4faf
CL 239754 eagerly initialized the environment. This turns out to be a problem for gopls, which calls ApplyFixes with no ProcessEnv. Reinitializing it every time seriously harmed the performance of unimported completions. Move back to lazy initialization. Working with invalid options has caused a lot of confusion; this is only the most recent. We have to maintain backwards compatibility in the externally visible API, but everywhere else we can require fully populated options. That includes the source byte slice and the options. LocalPrefix is really more of an Option than an attribute of the ProcessEnv, and it is needed in ApplyFixes where we really don't want to have to pass a ProcessEnv. Move it up to Options. Change-Id: Ib9466c375a640a521721da4587091bf93bbdaa3c Reviewed-on: https://go-review.googlesource.com/c/tools/+/241159 Run-TryBot: Heschi Kreinick <heschi@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org>
14 lines
166 B
Go
14 lines
166 B
Go
package imports
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"golang.org/x/tools/internal/testenv"
|
|
)
|
|
|
|
func TestMain(m *testing.M) {
|
|
testenv.ExitIfSmallMachine()
|
|
os.Exit(m.Run())
|
|
}
|