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

Method fieldPtr

internal/driver/config.go:200–207  ·  view source on GitHub ↗

fieldPtr returns a pointer to the field identified by f in *cfg.

(f configField)

Source from the content-addressed store, hash-verified

198
199// fieldPtr returns a pointer to the field identified by f in *cfg.
200func (cfg *config) fieldPtr(f configField) interface{} {
201 // reflect.ValueOf: converts to reflect.Value
202 // Elem: dereferences cfg to make *cfg
203 // FieldByIndex: fetches the field
204 // Addr: takes address of field
205 // Interface: converts back from reflect.Value to a regular value
206 return reflect.ValueOf(cfg).Elem().FieldByIndex(f.field.Index).Addr().Interface()
207}
208
209// get returns the value of field f in cfg.
210func (cfg *config) get(f configField) string {

Callers 4

getMethod · 0.95
setMethod · 0.95
isBoolConfigFunction · 0.95
installConfigFlagsFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected