diff --git a/pkg/server/helper.go b/pkg/server/helper.go index 4b6c475..b8d81f7 100644 --- a/pkg/server/helper.go +++ b/pkg/server/helper.go @@ -15,19 +15,14 @@ const ( ) func duration(duration, mode string) (d time.Duration, err error) { - var m int - m, _ = strconv.Atoi(mode) - switch m { - case 0: - err = errors.New("invalid mode") - return - case 1: + switch mode { + case "1": d, err = time.ParseDuration(duration) if err != nil { err = errors.New("could not parse duration") return } - case 2: + case "2": var t int t, err = strconv.Atoi(duration) if err != nil { @@ -35,6 +30,9 @@ func duration(duration, mode string) (d time.Duration, err error) { return } d = time.Duration(int(day) * t) + default: + err = errors.New("invalid mode") + return } if d < min { diff --git a/pkg/server/templates.go b/pkg/server/templates.go index d2a9129..a110ae2 100644 --- a/pkg/server/templates.go +++ b/pkg/server/templates.go @@ -510,9 +510,9 @@ const (