diff options
| author | Maciej Borzecki <maciej.zenon.borzecki@canonical.com> | 2017-12-14 08:28:58 +0100 |
|---|---|---|
| committer | Maciej Borzecki <maciej.zenon.borzecki@canonical.com> | 2017-12-14 08:28:58 +0100 |
| commit | 5b76ae9cfa7cd22fbcf33f4c03c37af4dcce0587 (patch) | |
| tree | 71a84522661cc43ce9b2ddc7b674604ecab62ff8 /timeutil | |
| parent | bb5eb7dfbc5fddbac88eda7cce90243120e0ad53 (diff) | |
timeutil: parseCount() cleanup
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
Diffstat (limited to 'timeutil')
| -rw-r--r-- | timeutil/schedule.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/timeutil/schedule.go b/timeutil/schedule.go index b109faf7e6..a3ea2cdf84 100644 --- a/timeutil/schedule.go +++ b/timeutil/schedule.go @@ -636,16 +636,16 @@ func parseCount(s string) (count uint, rest string, err error) { } // timespan = time ( "-" / "~" ) time [ "/" ( time / count ) ] - ws := strings.Split(s, countToken) - if len(ws) != 2 { + split := strings.Split(s, countToken) + if len(split) != 2 { return 0, "", fmt.Errorf("cannot parse %q: invalid event count", s) } - rest = ws[0] - countStr := ws[1] + rest = split[0] + countStr := split[1] c, err := strconv.ParseUint(countStr, 10, 32) if err != nil || c == 0 { - return 0, "", fmt.Errorf("cannot parse %q: not a valid event interval", s) + return 0, "", fmt.Errorf("cannot parse %q: invalid event interval", s) } return uint(c), rest, nil } |
