Skip to content
Myr

refactor: use maps.Copy and maps.Clone (#4518)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by mickychang9 · committed by GitHub · parent 9bdacc8 · Browse files · 3 files+6 added−11 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Signed-off-by: mickychang9 <mickychang9@outlook.com>

Diff stats

3 files+6 added−11 removed

  • other:+6 added−11 removed

3 files+6 added−11 removed

modified:src/core.go+2 added-4 removed
1// Package fzf implements fzf, a command-line fuzzy finder.2package fzf34import (5 "maps"6 "os"7 "sync"8 "time"9
215 unmodified lines
225 denyMutex.Unlock()226 }227 patternBuilder := func(runes []rune) *Pattern {228 denyMutex.Lock()228 denylistCopy := make(map[int32]struct{})229 for k, v := range denylist {230 denylistCopy[k] = v231 }229 denylistCopy := maps.Clone(denylist)230 denyMutex.Unlock()231 return BuildPattern(cache, patternCache,232 opts.Fuzzy, opts.FuzzyAlgo, opts.Extended, opts.Case, opts.Normalize, forward, withPos,233 opts.Filter == nil, nth, opts.Delimiter, inputRevision, runes, denylistCopy)
300 unmodified lines
modified:src/options.go+2 added-3 removed
1 unmodified line
23import (4 "errors"5 "fmt"6 "maps"7 "os"8 "regexp"9 "strconv"10 "strings"
2592 unmodified lines
2603 chords, _, err := parseKeyChords(str, "key names required")2604 if err != nil {2605 return err2606 }2606 for k, v := range chords {2607 opts.Expect[k] = v2608 }2607 maps.Copy(opts.Expect, chords)2608 case "--no-expect":2609 opts.Expect = make(map[tui.Event]string)2610 case "--enabled", "--no-phony":2611 opts.Phony = false
1144 unmodified lines
modified:src/terminal.go+2 added-4 removed
4 unmodified lines
5 "context"6 "encoding/json"7 "fmt"8 "io"9 "maps"10 "math"11 "net"12 "os"13 "os/exec"
936 unmodified lines
950 sep := regexp.QuoteMeta(string(os.PathSeparator))951 wordRubout = fmt.Sprintf("%s[^%s]", sep, sep)952 wordNext = fmt.Sprintf("[^%s]%s|(.$)", sep, sep)953 }953 keymapCopy := make(map[tui.Event][]*action)954 for key, action := range opts.Keymap {955 keymapCopy[key] = action956 }954 keymapCopy := maps.Clone(opts.Keymap)955956 t := Terminal{957 initDelay: delay,958 infoCommand: opts.InfoCommand,
6109 unmodified lines