relaxedParseBool parses a string into a boolean value, treating various common false values or empty strings as false, and everything else as true. It is case-insensitive and trims whitespace.
(s string)
| 58 | // common false values or empty strings as false, and everything else as true. |
| 59 | // It is case-insensitive and trims whitespace. |
| 60 | func relaxedParseBool(s string) bool { |
| 61 | s = strings.TrimSpace(strings.ToLower(s)) |
| 62 | falseValues := []string{"", "false", "0", "no", "off", "n", "f"} |
| 63 | return !slices.Contains(falseValues, s) |
| 64 | } |