refactor: use maps.Copy and maps.Clone (#4518)
Some checks failed
CodeQL / Analyze (go) (push) Has been cancelled
build / build (push) Has been cancelled
Test fzf on macOS / build (push) Has been cancelled

Signed-off-by: mickychang9 <mickychang9@outlook.com>
This commit is contained in:
mickychang9
2025-09-29 17:11:19 +08:00
committed by GitHub
parent 9bdacc8df2
commit 760d1b7c58
3 changed files with 6 additions and 11 deletions

View File

@@ -2,6 +2,7 @@
package fzf
import (
"maps"
"os"
"sync"
"time"
@@ -225,10 +226,7 @@ func Run(opts *Options) (int, error) {
}
patternBuilder := func(runes []rune) *Pattern {
denyMutex.Lock()
denylistCopy := make(map[int32]struct{})
for k, v := range denylist {
denylistCopy[k] = v
}
denylistCopy := maps.Clone(denylist)
denyMutex.Unlock()
return BuildPattern(cache, patternCache,
opts.Fuzzy, opts.FuzzyAlgo, opts.Extended, opts.Case, opts.Normalize, forward, withPos,