fix golint errors

This commit is contained in:
2026-02-12 18:00:32 +03:00
parent a058b622e3
commit ccabeee1f1
10 changed files with 74 additions and 28 deletions
+3 -6
View File
@@ -22,19 +22,16 @@ type Selector struct {
logger *slog.Logger
}
func NewSelector(client *memos.Client, store *storage.Storage, cfg config.SearchConfig, loc *time.Location, logger *slog.Logger) *Selector {
func NewSelector(client *memos.Client, store *storage.Storage, cfg *config.SearchConfig, loc *time.Location, logger *slog.Logger) *Selector {
return &Selector{
client: client,
store: store,
cfg: cfg,
cfg: *cfg,
loc: loc,
logger: logger,
}
}
// tierFunc returns date ranges for a given tier.
type tierFunc func(today time.Time, maxYears int, loc *time.Location) []DateRange
// Select runs the full search algorithm and returns one Memory for the given day.
func (s *Selector) Select(ctx context.Context, today time.Time) (*Memory, error) {
weights := s.cfg.TierWeights.AsSlice()
@@ -248,7 +245,7 @@ func weightedTierOrder(weights [7]int) []int {
break
}
r := rand.IntN(totalWeight)
r := rand.IntN(totalWeight) //nolint:gosec // non-cryptographic use
cumulative := 0
for i, e := range remaining {
cumulative += e.weight