MCPcopy
hub / github.com/robfig/cron / mustParseInt

Function mustParseInt

parser.go:331–341  ·  view source on GitHub ↗

mustParseInt parses the given expression as an int or returns an error.

(expr string)

Source from the content-addressed store, hash-verified

329
330// mustParseInt parses the given expression as an int or returns an error.
331func mustParseInt(expr string) (uint, error) {
332 num, err := strconv.Atoi(expr)
333 if err != nil {
334 return 0, fmt.Errorf("failed to parse int from %s: %s", expr, err)
335 }
336 if num < 0 {
337 return 0, fmt.Errorf("negative number (%d) not allowed: %s", num, expr)
338 }
339
340 return uint(num), nil
341}
342
343// getBits sets all bits in the range [min, max], modulo the given step size.
344func getBits(min, max, step uint) uint64 {

Callers 2

getRangeFunction · 0.85
parseIntOrNameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected