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

Function parse

internal/godebug/godebug.go:206–237  ·  view source on GitHub ↗

parse parses the GODEBUG setting string s, which has the form k=v,k2=v2,k3=v3. Later settings override earlier ones. Parse only updates settings k=v for which did[k] = false. It also sets did[k] = true for settings that it updates. Each value v can also have the form v#pattern, in which case the GOD

(did map[string]bool, s string)

Source from the content-addressed store, hash-verified

204// in which case the GODEBUG is only enabled for call stacks
205// matching pattern, for use with golang.org/x/tools/cmd/bisect.
206func parse(did map[string]bool, s string) {
207 // Scan the string backward so that later settings are used
208 // and earlier settings are ignored.
209 // Note that a forward scan would cause cached values
210 // to temporarily use the ignored value before being
211 // updated to the "correct" one.
212 end := len(s)
213 eq := -1
214 for i := end - 1; i >= -1; i-- {
215 if i == -1 || s[i] == ',' {
216 if eq >= 0 {
217 name, arg := s[i+1:eq], s[eq+1:end]
218 if !did[name] {
219 did[name] = true
220 v := &value{text: arg}
221 for j := 0; j < len(arg); j++ {
222 if arg[j] == '#' {
223 v.text = arg[:j]
224 v.bisect, _ = bisect.New(arg[j+1:])
225 break
226 }
227 }
228 lookup(name).value.Store(v)
229 }
230 }
231 eq = -1
232 end = i
233 } else if s[i] == '=' {
234 eq = i
235 }
236 }
237}
238
239type runtimeStderr struct{}
240

Callers 1

updateFunction · 0.85

Calls 2

NewFunction · 0.92
lookupFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…