Documentation
ΒΆ
Overview ΒΆ
Package testlog provides a back-channel communication path between tests and package os, so that cmd/go can see which environment variables and files a test consults.
Index ΒΆ
Constants ΒΆ
This section is empty.
Variables ΒΆ
This section is empty.
Functions ΒΆ
func PanicOnExit0 ΒΆ added in go1.16
func PanicOnExit0() bool
PanicOnExit0 reports whether to panic on a call to os.Exit(0). This is in the testlog package because, like other definitions in package testlog, it is a hook between the testing package and the os package. This is used to ensure that an early call to os.Exit(0) does not cause a test to pass.
func SetLogger ΒΆ
func SetLogger(impl Interface)
SetLogger sets the test logger implementation for the current process. It must be called only once, at process startup.
func SetPanicOnExit0 ΒΆ added in go1.16
func SetPanicOnExit0(v bool)
SetPanicOnExit0 sets panicOnExit0 to v.
SetPanicOnExit0 should be an internal detail, but alternate implementations of go test in other build systems may need to access it using linkname.
Do not remove or change the type signature. See go.dev/issue/67401.
Types ΒΆ
type Interface ΒΆ
type Interface interface {
Getenv(key string)
Stat(file string)
Open(file string)
Chdir(dir string)
}
Interface is the interface required of test loggers. The os package will invoke the interface's methods to indicate that it is inspecting the given environment variables or files. Multiple goroutines may call these methods simultaneously.