Skip to content

Commit 745afa4

Browse files
committed
Code review feedback
Signed-off-by: Nick Pillitteri <[email protected]>
1 parent 2a23014 commit 745afa4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

model/time.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -262,13 +262,16 @@ func (d Duration) MarshalJSON() ([]byte, error) {
262262

263263
// UnmarshalJSON implements the json.Unmarshaler interface.
264264
func (d *Duration) UnmarshalJSON(bytes []byte) error {
265-
var err error
266265
var s string
267266
if err := json.Unmarshal(bytes, &s); err != nil {
268267
return err
269268
}
270-
*d, err = ParseDuration(s)
271-
return err
269+
dur, err := ParseDuration(s)
270+
if err != nil {
271+
return err
272+
}
273+
*d = dur
274+
return nil
272275
}
273276

274277
// MarshalText implements the encoding.TextMarshaler interface.

0 commit comments

Comments
 (0)