MCPcopy Create free account
hub / github.com/google/pprof / setConfig

Function setConfig

internal/driver/settings.go:125–145  ·  view source on GitHub ↗

setConfig saves the config specified in request to fname.

(fname string, request url.URL)

Source from the content-addressed store, hash-verified

123
124// setConfig saves the config specified in request to fname.
125func setConfig(fname string, request url.URL) error {
126 q := request.Query()
127 name := q.Get("config")
128 if name == "" {
129 return fmt.Errorf("invalid config name")
130 }
131 cfg := currentConfig()
132 if err := cfg.applyURL(q); err != nil {
133 return err
134 }
135 return editSettings(fname, func(s *settings) error {
136 for i, c := range s.Configs {
137 if c.Name == name {
138 s.Configs[i].config = cfg
139 return nil
140 }
141 }
142 s.Configs = append(s.Configs, namedConfig{Name: name, config: cfg})
143 return nil
144 })
145}
146
147// removeConfig removes config from fname.
148func removeConfig(fname, config string) error {

Callers 2

TestEditConfigFunction · 0.85
saveConfigMethod · 0.85

Calls 3

currentConfigFunction · 0.85
editSettingsFunction · 0.85
applyURLMethod · 0.80

Tested by 1

TestEditConfigFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…