MCPcopy
hub / github.com/uber-go/zap / Initialize

Function Initialize

internal/ztest/timeout.go:44–52  ·  view source on GitHub ↗

Initialize checks the environment and alters the timeout scale accordingly. It returns a function to undo the scaling.

(factor string)

Source from the content-addressed store, hash-verified

42// Initialize checks the environment and alters the timeout scale accordingly.
43// It returns a function to undo the scaling.
44func Initialize(factor string) func() {
45 fv, err := strconv.ParseFloat(factor, 64)
46 if err != nil {
47 panic(err)
48 }
49 original := _timeoutScale
50 _timeoutScale = fv
51 return func() { _timeoutScale = original }
52}
53
54func init() {
55 if v := os.Getenv("TEST_TIMEOUT_SCALE"); v != "" {

Callers 3

TestTimeoutFunction · 0.92
TestSleepFunction · 0.92
initFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestTimeoutFunction · 0.74
TestSleepFunction · 0.74