Skip to content

Commit

Permalink
Add NewDurationJSONOrPanic to be used in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
horkhe committed Oct 3, 2018
1 parent eb40d13 commit 64e6402
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions clock/duration.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ func NewDurationJSON(v interface{}) (DurationJSON, error) {
}
}

func NewDurationJSONOrPanic(v interface{}) DurationJSON {
d, err := NewDurationJSON(v)
if err != nil {
panic(err)
}
return d
}

func (d DurationJSON) MarshalJSON() ([]byte, error) {
return json.Marshal(d.Duration.String())
}
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.0
2.1.1

0 comments on commit 64e6402

Please sign in to comment.