We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2a23014 commit 745afa4Copy full SHA for 745afa4
model/time.go
@@ -262,13 +262,16 @@ func (d Duration) MarshalJSON() ([]byte, error) {
262
263
// UnmarshalJSON implements the json.Unmarshaler interface.
264
func (d *Duration) UnmarshalJSON(bytes []byte) error {
265
- var err error
266
var s string
267
if err := json.Unmarshal(bytes, &s); err != nil {
268
return err
269
}
270
- *d, err = ParseDuration(s)
271
- return err
+ dur, err := ParseDuration(s)
+ if err != nil {
+ return err
272
+ }
273
+ *d = dur
274
+ return nil
275
276
277
// MarshalText implements the encoding.TextMarshaler interface.
0 commit comments