MCPcopy Create free account
hub / github.com/imroc/req / update

Function update

internal/godebug/godebug.go:177–196  ·  view source on GitHub ↗

update records an updated GODEBUG setting. def is the default GODEBUG setting for the running binary, and env is the current value of the $GODEBUG environment variable.

(def, env string)

Source from the content-addressed store, hash-verified

175// def is the default GODEBUG setting for the running binary,
176// and env is the current value of the $GODEBUG environment variable.
177func update(def, env string) {
178 updateMu.Lock()
179 defer updateMu.Unlock()
180
181 // Update all the cached values, creating new ones as needed.
182 // We parse the environment variable first, so that any settings it has
183 // are already locked in place (did[name] = true) before we consider
184 // the defaults.
185 did := make(map[string]bool)
186 parse(did, env)
187 parse(did, def)
188
189 // Clear any cached values that are no longer present.
190 cache.Range(func(name, s any) bool {
191 if !did[name.(string)] {
192 s.(*setting).value.Store(&empty)
193 }
194 return true
195 })
196}
197
198// parse parses the GODEBUG setting string s,
199// which has the form k=v,k2=v2,k3=v3.

Callers

nothing calls this directly

Calls 3

parseFunction · 0.85
LockMethod · 0.80
UnlockMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…