mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-21 16:58:08 +08:00
Contraction variable scope
This commit is contained in:
parent
83e0c6f97e
commit
4773be0eb9
@ -266,8 +266,6 @@ func setTimeField(val string, structField reflect.StructField, value reflect.Val
|
|||||||
timeFormat = time.RFC3339
|
timeFormat = time.RFC3339
|
||||||
}
|
}
|
||||||
|
|
||||||
var t time.Time
|
|
||||||
|
|
||||||
switch tf := strings.ToLower(timeFormat); tf {
|
switch tf := strings.ToLower(timeFormat); tf {
|
||||||
case "unix", "unixnano":
|
case "unix", "unixnano":
|
||||||
tv, err := strconv.ParseInt(val, 10, 0)
|
tv, err := strconv.ParseInt(val, 10, 0)
|
||||||
@ -280,7 +278,7 @@ func setTimeField(val string, structField reflect.StructField, value reflect.Val
|
|||||||
d = time.Second
|
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))
|
value.Set(reflect.ValueOf(t))
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user