chore: fix linter errors

This commit is contained in:
Steven 2024-10-11 21:27:08 +08:00
parent 3370ecd4fc
commit cab981c393
4 changed files with 11 additions and 11 deletions

View file

@ -185,7 +185,7 @@ func (c *Cron) Entries() []Entry {
return c.entrySnapshot()
}
// Location gets the time zone location
// Location gets the time zone location.
func (c *Cron) Location() *time.Location {
return c.location
}
@ -219,7 +219,7 @@ func (c *Cron) Start() {
return
}
c.running = true
go c.run()
go c.runScheduler()
}
// Run the cron scheduler, or no-op if already running.
@ -231,12 +231,12 @@ func (c *Cron) Run() {
}
c.running = true
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.
func (c *Cron) run() {
func (c *Cron) runScheduler() {
c.logger.Info("start")
// 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 {
return time.Now().In(c.location)
}

View file

@ -9,10 +9,10 @@ import (
)
// 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.
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
// can be plugged in. It is a subset of the github.com/go-logr/logr interface.

View file

@ -358,7 +358,7 @@ func getBits(min, max, step uint) uint64 {
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 {
return getBits(r.min, r.max, 1) | starBit
}

View file

@ -178,8 +178,8 @@ WRAP:
// restrictions are satisfied by the given time.
func dayMatches(s *SpecSchedule, t time.Time) bool {
var (
domMatch bool = 1<<uint(t.Day())&s.Dom > 0
dowMatch bool = 1<<uint(t.Weekday())&s.Dow > 0
domMatch = 1<<uint(t.Day())&s.Dom > 0
dowMatch = 1<<uint(t.Weekday())&s.Dow > 0
)
if s.Dom&starBit > 0 || s.Dow&starBit > 0 {
return domMatch && dowMatch