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

Function stringToBool

internal/driver/commands.go:452–461  ·  view source on GitHub ↗

stringToBool is a custom parser for bools. We avoid using strconv.ParseBool to remain compatible with old pprof behavior (e.g., treating "" as true).

(s string)

Source from the content-addressed store, hash-verified

450// stringToBool is a custom parser for bools. We avoid using strconv.ParseBool
451// to remain compatible with old pprof behavior (e.g., treating "" as true).
452func stringToBool(s string) (bool, error) {
453 switch strings.ToLower(s) {
454 case "true", "t", "yes", "y", "1", "":
455 return true, nil
456 case "false", "f", "no", "n", "0":
457 return false, nil
458 default:
459 return false, fmt.Errorf(`illegal value "%s" for bool variable`, s)
460 }
461}

Callers 1

setMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…