Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: fix linter errors

Stevencab981c39319
diff --git a/internal/cron/cron.go b/internal/cron/cron.go
index 6055da7a9..03411ddb0 100644
--- a/internal/cron/cron.go
+++ b/internal/cron/cron.go
@@ -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)
}
diff --git a/internal/cron/logger.go b/internal/cron/logger.go
index bfb89f360..2a3611768 100644
--- a/internal/cron/logger.go
+++ b/internal/cron/logger.go
@@ -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.
diff --git a/internal/cron/parser.go b/internal/cron/parser.go
index d19ccc6e4..e1607a116 100644
--- a/internal/cron/parser.go
+++ b/internal/cron/parser.go
@@ -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
}
diff --git a/internal/cron/spec.go b/internal/cron/spec.go
index fa1e241e5..9821a6a2e 100644
--- a/internal/cron/spec.go
+++ b/internal/cron/spec.go
@@ -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