Commit e3c2916
committed
refactor(eviction): replace unsafe int→uint32 casts with safe converter
Replace two `//nolint:gosec` suppressed `uint32(...)` casts in `Sharded`
with explicit calls to `converters.ToUint32` from `github.com/hyp3rd/sectools`.
- `NewSharded`: compute shard mask via `converters.ToUint32(shardCount - 1)`
and propagate any conversion error instead of silencing the lint warning.
- `Evict`: convert `len(s.shards)` via `converters.ToUint32`, returning a
zero-value on error rather than casting unchecked.
- Add the `sectools/pkg/converters` import to `sharded.go`.
- Register unsharded in `cspell.config.yaml` to keep spell-check clean.1 parent 4a9f54f commit e3c2916
2 files changed
Lines changed: 14 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| 162 | + | |
162 | 163 | | |
163 | 164 | | |
164 | 165 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
55 | 62 | | |
56 | 63 | | |
57 | | - | |
| 64 | + | |
58 | 65 | | |
59 | 66 | | |
60 | 67 | | |
| |||
82 | 89 | | |
83 | 90 | | |
84 | 91 | | |
85 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
86 | 97 | | |
87 | 98 | | |
88 | 99 | | |
| |||
0 commit comments