fix default mapping error

This commit is contained in:
Unknwon
2015-12-10 12:26:54 -05:00
parent 9f4d2712cf
commit 9314fb0ef6
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ const (
// Maximum allowed depth when recursively substituing variable names.
_DEPTH_VALUES = 99
_VERSION = "1.8.2"
_VERSION = "1.8.3"
)
func Version() string {
+3 -2
View File
@@ -94,13 +94,14 @@ func setWithProperType(t reflect.Type, key *Key, field reflect.Value, delim stri
field.SetBool(boolVal)
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
durationVal, err := key.Duration()
if err == nil {
// Skip zero value
if err == nil && int(durationVal) > 0 {
field.Set(reflect.ValueOf(durationVal))
return nil
}
intVal, err := key.Int64()
if err != nil {
if err != nil || intVal == 0 {
return nil
}
field.SetInt(intVal)