Skip to content

Commit

Permalink
Contraction variable scope
Browse files Browse the repository at this point in the history
  • Loading branch information
guonaihong committed Jul 10, 2019
1 parent 83e0c6f commit 4773be0
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions binding/form_mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down

0 comments on commit 4773be0

Please sign in to comment.