Contraction variable scope

This commit is contained in:
guonaihong 2019-07-10 12:38:10 +08:00
parent 83e0c6f97e
commit 4773be0eb9

View File

@ -266,8 +266,6 @@ func setTimeField(val string, structField reflect.StructField, value reflect.Val
timeFormat = time.RFC3339
}
var t time.Time
switch tf := strings.ToLower(timeFormat); tf {
case "unix", "unixnano":
tv, err := strconv.ParseInt(val, 10, 0)
@ -280,7 +278,7 @@ func setTimeField(val string, structField reflect.StructField, value reflect.Val
d = time.Second
}
t = time.Unix(tv/int64(d), tv%int64(d))
t := time.Unix(tv/int64(d), tv%int64(d))
value.Set(reflect.ValueOf(t))
return nil