Skip to content

Commit

Permalink
Code review feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Pillitteri <nick.pillitteri@grafana.com>
  • Loading branch information
56quarters committed Mar 5, 2021
1 parent 2a23014 commit 745afa4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions model/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,16 @@ func (d Duration) MarshalJSON() ([]byte, error) {

// UnmarshalJSON implements the json.Unmarshaler interface.
func (d *Duration) UnmarshalJSON(bytes []byte) error {
var err error
var s string
if err := json.Unmarshal(bytes, &s); err != nil {
return err
}
*d, err = ParseDuration(s)
return err
dur, err := ParseDuration(s)
if err != nil {
return err
}
*d = dur
return nil
}

// MarshalText implements the encoding.TextMarshaler interface.
Expand Down

0 comments on commit 745afa4

Please sign in to comment.