mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 19:50:56 +00:00
Merge pull request #2740 from xlwcom/master
fix the bugs in the "ParseBool" function in the file of config.go
This commit is contained in:
commit
1aba294405
@ -189,16 +189,16 @@ func ParseBool(val interface{}) (value bool, err error) {
|
|||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
case int8, int32, int64:
|
case int8, int32, int64:
|
||||||
strV := fmt.Sprintf("%s", v)
|
strV := fmt.Sprintf("%d", v)
|
||||||
if strV == "1" {
|
if strV == "1" {
|
||||||
return true, nil
|
return true, nil
|
||||||
} else if strV == "0" {
|
} else if strV == "0" {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
case float64:
|
case float64:
|
||||||
if v == 1 {
|
if v == 1.0 {
|
||||||
return true, nil
|
return true, nil
|
||||||
} else if v == 0 {
|
} else if v == 0.0 {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user