diff --git a/types/types.go b/types/types.go index d20ba6f..b79d2a2 100644 --- a/types/types.go +++ b/types/types.go @@ -514,7 +514,7 @@ func (d *Duration) Deref() time.Duration { func formatDuration(d time.Duration) string { var sb strings.Builder if d == 0 { - return "0" + return "0s" } if d < 0 { sb.WriteByte('-') diff --git a/types/types_test.go b/types/types_test.go index a40d623..8516896 100644 --- a/types/types_test.go +++ b/types/types_test.go @@ -117,6 +117,7 @@ func TestFormatDuration(t *testing.T) { d time.Duration str string }{ + {0, "0s"}, {5 * time.Second, "5s"}, {5 * time.Minute, "5m"}, {5 * time.Hour, "5h"},