mirror of
https://github.com/minio/minio.git
synced 2025-11-10 14:09:48 -05:00
Rewrite if-else chains to switch statements (#7382)
This commit is contained in:
committed by
kannappanr
parent
6702d23d52
commit
3d29ab4059
@@ -549,11 +549,12 @@ func timestampCast(v *Value) (t time.Time, _ error) {
|
||||
|
||||
func boolCast(v *Value) (b bool, _ error) {
|
||||
sToB := func(s string) (bool, error) {
|
||||
if s == "true" {
|
||||
switch s {
|
||||
case "true":
|
||||
return true, nil
|
||||
} else if s == "false" {
|
||||
case "false":
|
||||
return false, nil
|
||||
} else {
|
||||
default:
|
||||
return false, errCastFailure("cannot cast to Bool")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user