// packageMainIsDevel reports whether the module containing package main // is a development version (if module information is available). func packageMainIsDevel() bool { … } var checkGoBuild … // HasTool reports an error if the required tool is not available in PATH. // // For certain tools, it checks that the tool executable is correct. func HasTool(tool string) error { … } func cgoEnabled(bypassEnvironment bool) (bool, error) { … } func allowMissingTool(tool string) bool { … } // NeedsTool skips t if the named tool is not present in the path. // As a special case, "cgo" means "go" is present and can compile cgo programs. func NeedsTool(t testing.TB, tool string) { … } // NeedsGoPackages skips t if the go/packages driver (or 'go' tool) implied by // the current process environment is not present in the path. func NeedsGoPackages(t testing.TB) { … } // NeedsGoPackagesEnv skips t if the go/packages driver (or 'go' tool) implied // by env is not present in the path. func NeedsGoPackagesEnv(t testing.TB, env []string) { … } // NeedsGoBuild skips t if the current system can't build programs with “go build” // and then run them with os.StartProcess or exec.Command. // Android doesn't have the userspace go build needs to run, // and js/wasm doesn't support running subprocesses. func NeedsGoBuild(t testing.TB) { … } // ExitIfSmallMachine emits a helpful diagnostic and calls os.Exit(0) if the // current machine is a builder known to have scarce resources. // // It should be called from within a TestMain function. func ExitIfSmallMachine() { … } // Go1Point returns the x in Go 1.x. func Go1Point() int { … } // NeedsGoCommand1Point skips t if the ambient go command version in the PATH // of the current process is older than 1.x. // // NeedsGoCommand1Point memoizes the result of running the go command, so // should be called after all mutations of PATH. func NeedsGoCommand1Point(t testing.TB, x int) { … } var goCommand1PointOnce … var goCommand1Point_ … var goCommand1PointErr … func goCommand1Point() (int, error) { … } // NeedsGo1Point skips t if the Go version used to run the test is older than // 1.x. func NeedsGo1Point(t testing.TB, x int) { … } // SkipAfterGo1Point skips t if the ambient go command version in the PATH of // the current process is newer than 1.x. // // SkipAfterGoCommand1Point memoizes the result of running the go command, so // should be called after any mutation of PATH. func SkipAfterGoCommand1Point(t testing.TB, x int) { … } // SkipAfterGo1Point skips t if the Go version used to run the test is newer than // 1.x. func SkipAfterGo1Point(t testing.TB, x int) { … } // NeedsLocalhostNet skips t if networking does not work for ports opened // with "localhost". func NeedsLocalhostNet(t testing.TB) { … } // Deadline returns the deadline of t, if known, // using the Deadline method added in Go 1.15. func Deadline(t testing.TB) (time.Time, bool) { … } // WriteImportcfg writes an importcfg file used by the compiler or linker to // dstPath containing entries for the packages in std and cmd in addition // to the package to package file mappings in additionalPackageFiles. func WriteImportcfg(t testing.TB, dstPath string, additionalPackageFiles map[string]string) { … } var gorootOnce … var gorootPath … var gorootErr … func findGOROOT() (string, error) { … } // GOROOT reports the path to the directory containing the root of the Go // project source tree. This is normally equivalent to runtime.GOROOT, but // works even if the test binary was built with -trimpath. // // If GOROOT cannot be found, GOROOT skips t if t is non-nil, // or panics otherwise. func GOROOT(t testing.TB) string { … } // NeedsLocalXTools skips t if the golang.org/x/tools module is replaced and // its replacement directory does not exist (or does not contain the module). func NeedsLocalXTools(t testing.TB) { … } // NeedsGoExperiment skips t if the current process environment does not // have a GOEXPERIMENT flag set. func NeedsGoExperiment(t testing.TB, flag string) { … } // NeedsGOROOTDir skips the test if GOROOT/dir does not exist, and GOROOT is a // released version of Go (=has a VERSION file). Some GOROOT directories are // removed by cmd/distpack. // // See also golang/go#70081. func NeedsGOROOTDir(t *testing.T, dir string) { … }