chore: fix linter errors
This commit is contained in:
parent
3370ecd4fc
commit
cab981c393
4 changed files with 11 additions and 11 deletions
|
|
@ -185,7 +185,7 @@ func (c *Cron) Entries() []Entry {
|
||||||
return c.entrySnapshot()
|
return c.entrySnapshot()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Location gets the time zone location
|
// Location gets the time zone location.
|
||||||
func (c *Cron) Location() *time.Location {
|
func (c *Cron) Location() *time.Location {
|
||||||
return c.location
|
return c.location
|
||||||
}
|
}
|
||||||
|
|
@ -219,7 +219,7 @@ func (c *Cron) Start() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.running = true
|
c.running = true
|
||||||
go c.run()
|
go c.runScheduler()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run the cron scheduler, or no-op if already running.
|
// Run the cron scheduler, or no-op if already running.
|
||||||
|
|
@ -231,12 +231,12 @@ func (c *Cron) Run() {
|
||||||
}
|
}
|
||||||
c.running = true
|
c.running = true
|
||||||
c.runningMu.Unlock()
|
c.runningMu.Unlock()
|
||||||
c.run()
|
c.runScheduler()
|
||||||
}
|
}
|
||||||
|
|
||||||
// run the scheduler.. this is private just due to the need to synchronize
|
// runScheduler runs the scheduler.. this is private just due to the need to synchronize
|
||||||
// access to the 'running' state variable.
|
// access to the 'running' state variable.
|
||||||
func (c *Cron) run() {
|
func (c *Cron) runScheduler() {
|
||||||
c.logger.Info("start")
|
c.logger.Info("start")
|
||||||
|
|
||||||
// Figure out the next activation times for each entry.
|
// Figure out the next activation times for each entry.
|
||||||
|
|
@ -313,7 +313,7 @@ func (c *Cron) startJob(j Job) {
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
// now returns current time in c location
|
// now returns current time in c location.
|
||||||
func (c *Cron) now() time.Time {
|
func (c *Cron) now() time.Time {
|
||||||
return time.Now().In(c.location)
|
return time.Now().In(c.location)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// DefaultLogger is used by Cron if none is specified.
|
// DefaultLogger is used by Cron if none is specified.
|
||||||
var DefaultLogger Logger = PrintfLogger(log.New(os.Stdout, "cron: ", log.LstdFlags))
|
var DefaultLogger = PrintfLogger(log.New(os.Stdout, "cron: ", log.LstdFlags))
|
||||||
|
|
||||||
// DiscardLogger can be used by callers to discard all log messages.
|
// DiscardLogger can be used by callers to discard all log messages.
|
||||||
var DiscardLogger Logger = PrintfLogger(log.New(io.Discard, "", 0))
|
var DiscardLogger = PrintfLogger(log.New(io.Discard, "", 0))
|
||||||
|
|
||||||
// Logger is the interface used in this package for logging, so that any backend
|
// Logger is the interface used in this package for logging, so that any backend
|
||||||
// can be plugged in. It is a subset of the github.com/go-logr/logr interface.
|
// can be plugged in. It is a subset of the github.com/go-logr/logr interface.
|
||||||
|
|
|
||||||
|
|
@ -358,7 +358,7 @@ func getBits(min, max, step uint) uint64 {
|
||||||
return bits
|
return bits
|
||||||
}
|
}
|
||||||
|
|
||||||
// all returns all bits within the given bounds. (plus the star bit)
|
// all returns all bits within the given bounds.
|
||||||
func all(r bounds) uint64 {
|
func all(r bounds) uint64 {
|
||||||
return getBits(r.min, r.max, 1) | starBit
|
return getBits(r.min, r.max, 1) | starBit
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -178,8 +178,8 @@ WRAP:
|
||||||
// restrictions are satisfied by the given time.
|
// restrictions are satisfied by the given time.
|
||||||
func dayMatches(s *SpecSchedule, t time.Time) bool {
|
func dayMatches(s *SpecSchedule, t time.Time) bool {
|
||||||
var (
|
var (
|
||||||
domMatch bool = 1<<uint(t.Day())&s.Dom > 0
|
domMatch = 1<<uint(t.Day())&s.Dom > 0
|
||||||
dowMatch bool = 1<<uint(t.Weekday())&s.Dow > 0
|
dowMatch = 1<<uint(t.Weekday())&s.Dow > 0
|
||||||
)
|
)
|
||||||
if s.Dom&starBit > 0 || s.Dow&starBit > 0 {
|
if s.Dom&starBit > 0 || s.Dow&starBit > 0 {
|
||||||
return domMatch && dowMatch
|
return domMatch && dowMatch
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue