mirror of
https://github.com/astaxie/beego.git
synced 2025-06-12 10:10:40 +00:00
fix CI and UT
This commit is contained in:
@ -92,7 +92,15 @@ func (c *JSONConfigContainer) DefaultBool(key string, defaultval bool) bool {
|
||||
// Int returns the integer value for a given key.
|
||||
func (c *JSONConfigContainer) Int(key string) (int, error) {
|
||||
val := c.getData(key)
|
||||
return strconv.Atoi(val.(string))
|
||||
if val != nil {
|
||||
if v, ok := val.(float64); ok {
|
||||
return int(v), nil
|
||||
} else if v, ok := val.(string); ok {
|
||||
return strconv.Atoi(v)
|
||||
}
|
||||
return 0, errors.New("not int value")
|
||||
}
|
||||
return 0, errors.New("not exist key:" + key)
|
||||
}
|
||||
|
||||
// DefaultInt returns the integer value for a given key.
|
||||
|
Reference in New Issue
Block a user