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)
| 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). |
| 452 | func 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 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…