fix golint errors
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user