fix: lint issues in matched pool

This commit is contained in:
Daisuke Maki 2026-02-22 00:29:33 +09:00
parent a5c51bcc4b
commit 6be528ba24
2 changed files with 5 additions and 2 deletions

View file

@ -96,7 +96,7 @@ func BenchmarkRegexpFilterMultiCycle(b *testing.B) {
b.ResetTimer()
for b.Loop() {
// Simulate 3 keystroke cycles
for cycle := 0; cycle < 3; cycle++ {
for range 3 {
ctx := f.NewContext(context.Background(), query)
ch := make(chan line.Line, numLines)
_ = f.Apply(ctx, lines, pipeline.ChanOutput(ch))

View file

@ -12,7 +12,10 @@ var matchedPool = sync.Pool{
// GetMatched retrieves a Matched from the pool and initializes it.
func GetMatched(rl Line, matches [][]int) *Matched {
m := matchedPool.Get().(*Matched)
m, ok := matchedPool.Get().(*Matched)
if !ok {
m = &Matched{}
}
m.Line = rl
m.indices = matches
return m