From b085b4b5a76c9c3635be5627f103cf728172f86d Mon Sep 17 00:00:00 2001 From: Zhang Wei Date: Tue, 19 May 2015 10:54:04 +0800 Subject: [PATCH] clean some redundant else clauses Signed-off-by: Zhang Wei --- units/duration.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/units/duration.go b/units/duration.go index a31f780..44012aa 100644 --- a/units/duration.go +++ b/units/duration.go @@ -26,7 +26,6 @@ func HumanDuration(d time.Duration) string { return fmt.Sprintf("%d weeks", hours/24/7) } else if hours < 24*365*2 { return fmt.Sprintf("%d months", hours/24/30) - } else { - return fmt.Sprintf("%d years", hours/24/365) } + return fmt.Sprintf("%d years", int(d.Hours())/24/365) }