From f3bcd190b06c59d1a8c2fe16e982444363886f35 Mon Sep 17 00:00:00 2001 From: ktr Date: Sun, 17 Jan 2021 15:50:47 +0900 Subject: [PATCH] revert the chages which migrates terminal library from nsf/termbox-go to gdamore/tcell (#47) --- .github/workflows/main.yml | 2 +- .golangci.yml | 2 +- example_test.go | 24 +- fuzzing_test.go | 111 ++++----- fuzzyfinder.go | 230 +++++------------- fuzzyfinder_test.go | 188 +++++--------- go.mod | 8 +- go.sum | 126 +++++----- helper_test.go | 5 +- mock.go | 174 +------------ mock_test.go | 67 ----- tcell.go | 49 +++- .../fixtures/testfind-arrow_left-right.golden | 4 +- .../testfind-arrow_left_backspace.golden | 11 - .../fixtures/testfind-arrow_up-down.golden | 6 +- testdata/fixtures/testfind-backspace.golden | 4 +- testdata/fixtures/testfind-backspace2.golden | 4 +- ...ace_doesnt_change_x_if_cursorx_is_0.golden | 6 +- .../fixtures/testfind-backspace_empty.golden | 6 +- testdata/fixtures/testfind-ctrl-e.golden | 4 +- testdata/fixtures/testfind-ctrl-u.golden | 4 +- testdata/fixtures/testfind-ctrl-w.golden | 4 +- ...ty.golden => testfind-ctrl-w_emtpy.golden} | 6 +- testdata/fixtures/testfind-delete.golden | 4 +- .../fixtures/testfind-delete_empty.golden | 6 +- testdata/fixtures/testfind-initial.golden | 6 +- testdata/fixtures/testfind-input_glow.golden | 6 +- testdata/fixtures/testfind-input_lo.golden | 6 +- testdata/fixtures/testfind-long_item.golden | 6 +- testdata/fixtures/testfind-paging.golden | 6 +- .../fixtures/testfind-tab_doesnt_work.golden | 6 +- testdata/fixtures/testfind_hotreload.golden | 6 +- 32 files changed, 361 insertions(+), 736 deletions(-) delete mode 100644 testdata/fixtures/testfind-arrow_left_backspace.golden rename testdata/fixtures/{testfind-ctrl-w_empty.golden => testfind-ctrl-w_emtpy.golden} (67%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e0e2cc8..2e9fa0b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,7 +30,7 @@ jobs: run: go build - name: Test - run: go test -v -coverpkg ./... -covermode atomic -coverprofile coverage.txt -tags fuzz -numCases 3000 -numEvents 10 ./... + run: go test -v -coverpkg ./... -covermode atomic -coverprofile coverage.txt -tags fuzz -numCases 3000 -numEvents 300 ./... - name: Lint uses: golangci/golangci-lint-action@v2 diff --git a/.golangci.yml b/.golangci.yml index d14663d..493d1bc 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -37,13 +37,13 @@ linters: - nolintlint - rowserrcheck - errorlint - - exhaustivestruct - exportloopref - gci disable: - gosimple - unused - scopelint + - exhaustivestruct issues: exclude: diff --git a/example_test.go b/example_test.go index 7b97286..a029944 100644 --- a/example_test.go +++ b/example_test.go @@ -4,8 +4,8 @@ import ( "fmt" "io/ioutil" - "github.com/gdamore/tcell/v2" fuzzyfinder "github.com/ktr0731/go-fuzzyfinder" + "github.com/nsf/termbox-go" ) func ExampleFind() { @@ -70,14 +70,24 @@ func ExampleFindMulti() { } func ExampleTerminalMock() { - // Initialize a mocked terminal. - term := fuzzyfinder.UseMockedTerminalV2() - keys := "foo" - for _, r := range keys { - term.InjectKey(tcell.KeyRune, r, tcell.ModNone) + keys := func(str string) []termbox.Event { + s := []rune(str) + e := make([]termbox.Event, 0, len(s)) + for _, r := range s { + e = append(e, termbox.Event{Type: termbox.EventKey, Ch: r}) + } + return e } - term.InjectKey(tcell.KeyEsc, rune(tcell.KeyEsc), tcell.ModNone) + // Initialize a mocked terminal. + term := fuzzyfinder.UseMockedTerminal() + // Set the window size and events. + term.SetSize(60, 10) + term.SetEvents(append( + keys("foo"), + termbox.Event{Type: termbox.EventKey, Key: termbox.KeyEsc})...) + + // Call fuzzyfinder.Find. slice := []string{"foo", "bar", "baz"} _, _ = fuzzyfinder.Find(slice, func(i int) string { return slice[i] }) diff --git a/fuzzing_test.go b/fuzzing_test.go index cb1fdb1..3f3711a 100644 --- a/fuzzing_test.go +++ b/fuzzing_test.go @@ -11,56 +11,57 @@ import ( "sync" "testing" - "github.com/gdamore/tcell/v2" - fuzz "github.com/google/gofuzz" fuzzyfinder "github.com/ktr0731/go-fuzzyfinder" + "github.com/nsf/termbox-go" ) type fuzzKey struct { - key tcell.Key + key termbox.Key name string } var ( letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789一花二乃三玖四葉五月") - tbkeys = []tcell.Key{ - tcell.KeyCtrlA, - tcell.KeyCtrlB, - tcell.KeyCtrlE, - tcell.KeyCtrlF, - tcell.KeyBackspace, - tcell.KeyTab, - tcell.KeyCtrlJ, - tcell.KeyCtrlK, - tcell.KeyCtrlN, - tcell.KeyCtrlP, - tcell.KeyCtrlU, - tcell.KeyCtrlW, - tcell.KeyBackspace2, - tcell.KeyUp, - tcell.KeyDown, - tcell.KeyLeft, - tcell.KeyRight, + tbkeys = []termbox.Key{ + termbox.KeyCtrlA, + termbox.KeyCtrlB, + termbox.KeyCtrlE, + termbox.KeyCtrlF, + termbox.KeyBackspace, + termbox.KeyTab, + termbox.KeyCtrlJ, + termbox.KeyCtrlK, + termbox.KeyCtrlN, + termbox.KeyCtrlP, + termbox.KeyCtrlU, + termbox.KeyCtrlW, + termbox.KeySpace, + termbox.KeyBackspace2, + termbox.KeyArrowUp, + termbox.KeyArrowDown, + termbox.KeyArrowLeft, + termbox.KeyArrowRight, } - keyMap = map[tcell.Key]string{ - tcell.KeyCtrlA: "A", - tcell.KeyCtrlB: "B", - tcell.KeyCtrlE: "E", - tcell.KeyCtrlF: "F", - tcell.KeyBackspace: "backspace", - tcell.KeyTab: "tab", - tcell.KeyCtrlJ: "J", - tcell.KeyCtrlK: "K", - tcell.KeyCtrlN: "N", - tcell.KeyCtrlP: "P", - tcell.KeyCtrlU: "U", - tcell.KeyCtrlW: "W", - tcell.KeyBackspace2: "backspace2", - tcell.KeyUp: "up", - tcell.KeyDown: "down", - tcell.KeyLeft: "left", - tcell.KeyRight: "right", + keyMap = map[termbox.Key]string{ + termbox.KeyCtrlA: "A", + termbox.KeyCtrlB: "B", + termbox.KeyCtrlE: "E", + termbox.KeyCtrlF: "F", + termbox.KeyBackspace: "backspace", + termbox.KeyTab: "tab", + termbox.KeyCtrlJ: "J", + termbox.KeyCtrlK: "K", + termbox.KeyCtrlN: "N", + termbox.KeyCtrlP: "P", + termbox.KeyCtrlU: "U", + termbox.KeyCtrlW: "W", + termbox.KeySpace: "space", + termbox.KeyBackspace2: "backspace2", + termbox.KeyArrowUp: "up", + termbox.KeyArrowDown: "down", + termbox.KeyArrowLeft: "left", + termbox.KeyArrowRight: "right", } ) @@ -68,14 +69,14 @@ var ( out = flag.String("fuzzout", "fuzz.out", "fuzzing error cases") hotReload = flag.Bool("hotreload", false, "enable hot-reloading") numCases = flag.Int("numCases", 30, "number of test cases") - numEvents = flag.Int("numEvents", 10, "number of events") + numEvents = flag.Int("numEvents", 100, "number of events") ) // TestFuzz executes fuzzing tests. // // Example: // -// go test -tags fuzz -run TestFuzz -numCases 10 -numEvents 10 +// go test -tags fuzz -run TestFuzz -numCases 1000 -numEvents 100 // func TestFuzz(t *testing.T) { f, err := os.Create(*out) @@ -86,32 +87,25 @@ func TestFuzz(t *testing.T) { fuzz := fuzz.New() - min := func(a, b int) int { - if a < b { - return a - } - return b - } - for i := 0; i < rand.Intn(*numCases)+10; i++ { - // number of events in tcell.SimulationScreen is limited 10 - n := rand.Intn(min(*numEvents, 10)) - events := make([]tcell.Event, n) + n := rand.Intn(*numEvents) + 10 + events := make([]termbox.Event, n) for i := 0; i < n; i++ { if rand.Intn(10) > 3 { events[i] = ch(letters[rand.Intn(len(letters)-1)]) } else { - k := tbkeys[rand.Intn(len(tbkeys)-1)] - events[i] = key(input{k, rune(k), tcell.ModNone}) + events[i] = key(tbkeys[rand.Intn(len(tbkeys)-1)]) } } var name string for _, e := range events { - if e.(*tcell.EventKey).Rune() != 0 { - name += string(e.(*tcell.EventKey).Rune()) + if e.Key == termbox.KeySpace { + name += " " + } else if e.Ch != 0 { + name += string(e.Ch) } else { - name += "[" + keyMap[e.(*tcell.EventKey).Key()] + "]" + name += "[" + keyMap[e.Key] + "]" } } @@ -128,9 +122,8 @@ func TestFuzz(t *testing.T) { tracks := tracks f, term := fuzzyfinder.NewWithMockedTerminal() - events = append(events, key(input{tcell.KeyEsc, rune(tcell.KeyEsc), tcell.ModNone})) - - term.SetEventsV2(events...) + events = append(events, key(termbox.KeyEsc)) + term.SetEvents(events...) var ( iface interface{} diff --git a/fuzzyfinder.go b/fuzzyfinder.go index 0974760..2fb196d 100644 --- a/fuzzyfinder.go +++ b/fuzzyfinder.go @@ -15,10 +15,9 @@ import ( "unicode" "unicode/utf8" - "github.com/gdamore/tcell/v2" "github.com/ktr0731/go-fuzzyfinder/matching" runewidth "github.com/mattn/go-runewidth" - "github.com/micmonay/keybd_event" + "github.com/nsf/termbox-go" "github.com/pkg/errors" ) @@ -71,16 +70,11 @@ type finder struct { func (f *finder) initFinder(items []string, matched []matching.Matched, opt opt) error { if f.term == nil { - screen, err := tcell.NewScreen() - if err != nil { - return errors.Wrap(err, "failed to new screen") - } - f.term = &termImpl{ - screen: screen, - } - if err := f.term.Init(); err != nil { - return errors.Wrap(err, "failed to initialize screen") - } + f.term = &termImpl{} + } + + if err := f.term.init(); err != nil { + return errors.Wrap(err, "failed to initialize termbox") } f.opt = &opt @@ -97,7 +91,7 @@ func (f *finder) initFinder(items []string, matched []matching.Matched, opt opt) f.drawTimer = time.AfterFunc(0, func() { f._draw() f._drawPreview() - f.term.Show() + f.term.flush() }) f.drawTimer.Stop() } @@ -116,8 +110,8 @@ func (f *finder) updateItems(items []string, matched []matching.Matched) { // _draw is used from draw with a timer. func (f *finder) _draw() { - width, height := f.term.Size() - f.term.Clear() + width, height := f.term.size() + _ = f.term.clear(termbox.ColorDefault, termbox.ColorDefault) maxWidth := width if f.opt.previewFunc != nil { @@ -129,34 +123,21 @@ func (f *finder) _draw() { //nolint:staticcheck for _, r := range []rune(f.opt.promptString) { - style := tcell.StyleDefault. - Foreground(tcell.ColorBlue). - Background(tcell.ColorDefault) - - f.term.SetContent(promptLinePad, height-1, r, nil, style) + f.term.setCell(promptLinePad, height-1, r, termbox.ColorBlue, termbox.ColorDefault) promptLinePad++ } var r rune var w int for _, r = range f.state.input { - style := tcell.StyleDefault. - Foreground(tcell.ColorDefault). - Background(tcell.ColorDefault). - Bold(true) - // Add a space between '>' and runes. - f.term.SetContent(promptLinePad+w, height-1, r, nil, style) + f.term.setCell(promptLinePad+w, height-1, r, termbox.ColorDefault|termbox.AttrBold, termbox.ColorDefault) w += runewidth.RuneWidth(r) } - f.term.ShowCursor(promptLinePad+f.state.cursorX, height-1) + f.term.setCursor(promptLinePad+f.state.cursorX, height-1) // Number line for i, r := range fmt.Sprintf("%d/%d", len(f.state.matched), len(f.state.items)) { - style := tcell.StyleDefault. - Foreground(tcell.ColorYellow). - Background(tcell.ColorDefault) - - f.term.SetContent(2+i, height-2, r, nil, style) + f.term.setCell(2+i, height-2, r, termbox.ColorYellow, termbox.ColorDefault) } // Item lines @@ -172,66 +153,44 @@ func (f *finder) _draw() { break } if i == f.state.cursorY { - style := tcell.StyleDefault. - Foreground(tcell.ColorRed). - Background(tcell.ColorBlack) - - f.term.SetContent(0, height-3-i, '>', nil, style) - f.term.SetContent(1, height-3-i, ' ', nil, style) + f.term.setCell(0, height-3-i, '>', termbox.ColorRed, termbox.ColorBlack) + f.term.setCell(1, height-3-i, ' ', termbox.ColorRed, termbox.ColorBlack) } if f.opt.multi { if _, ok := f.state.selection[m.Idx]; ok { - style := tcell.StyleDefault. - Foreground(tcell.ColorRed). - Background(tcell.ColorBlack) - - f.term.SetContent(1, height-3-i, '>', nil, style) + f.term.setCell(1, height-3-i, '>', termbox.ColorRed, termbox.ColorBlack) } } var posIdx int w := 2 for j, r := range []rune(f.state.items[m.Idx]) { - style := tcell.StyleDefault. - Foreground(tcell.ColorDefault). - Background(tcell.ColorDefault) + fg := termbox.ColorDefault + bg := termbox.ColorDefault // Highlight selected strings. - hasHighlighted := false if posIdx < len(f.state.input) { from, to := m.Pos[0], m.Pos[1] if !(from == -1 && to == -1) && (from <= j && j <= to) { if unicode.ToLower(f.state.input[posIdx]) == unicode.ToLower(r) { - style = tcell.StyleDefault. - Foreground(tcell.ColorGreen). - Background(tcell.ColorDefault) - hasHighlighted = true + fg |= termbox.ColorGreen posIdx++ } } } if i == f.state.cursorY { - if hasHighlighted { - style = tcell.StyleDefault. - Foreground(tcell.ColorDarkCyan). - Bold(true). - Background(tcell.ColorBlack) - } else { - style = tcell.StyleDefault. - Foreground(tcell.ColorYellow). - Bold(true). - Background(tcell.ColorBlack) - } + fg |= termbox.AttrBold | termbox.ColorYellow + bg = termbox.ColorBlack } rw := runewidth.RuneWidth(r) // Shorten item cells. if w+rw+2 > maxWidth { - f.term.SetContent(w, height-3-i, '.', nil, style) - f.term.SetContent(w+1, height-3-i, '.', nil, style) + f.term.setCell(w, height-3-i, '.', fg, bg) + f.term.setCell(w+1, height-3-i, '.', fg, bg) break } else { - f.term.SetContent(w, height-3-i, r, nil, style) + f.term.setCell(w, height-3-i, r, fg, bg) w += rw } } @@ -243,7 +202,7 @@ func (f *finder) _drawPreview() { return } - width, height := f.term.Size() + width, height := f.term.size() var idx int if len(f.state.matched) == 0 { idx = -1 @@ -268,12 +227,7 @@ func (f *finder) _drawPreview() { default: r = '─' } - - style := tcell.StyleDefault. - Foreground(tcell.ColorBlack). - Background(tcell.ColorDefault) - - f.term.SetContent(i, 0, r, nil, style) + f.term.setCell(i, 0, r, termbox.ColorBlack, termbox.ColorDefault) } // bottom line for i := width / 2; i < width; i++ { @@ -286,12 +240,7 @@ func (f *finder) _drawPreview() { default: r = '─' } - - style := tcell.StyleDefault. - Foreground(tcell.ColorBlack). - Background(tcell.ColorDefault) - - f.term.SetContent(i, height-1, r, nil, style) + f.term.setCell(i, height-1, r, termbox.ColorBlack, termbox.ColorDefault) } // Start with h=1 to exclude each corner rune. const vline = '│' @@ -302,25 +251,15 @@ func (f *finder) _drawPreview() { switch { // Left vertical line. case i == width/2: - style := tcell.StyleDefault. - Foreground(tcell.ColorBlack). - Background(tcell.ColorDefault) - f.term.SetContent(i, h, vline, nil, style) + f.term.setCell(i, h, vline, termbox.ColorBlack, termbox.ColorDefault) w += wvline // Right vertical line. case i == width-1: - style := tcell.StyleDefault. - Foreground(tcell.ColorBlack). - Background(tcell.ColorDefault) - f.term.SetContent(i, h, vline, nil, style) + f.term.setCell(i, h, vline, termbox.ColorBlack, termbox.ColorDefault) w += wvline // Spaces between left and right vertical lines. case w == width/2+wvline, w == width-1-wvline: - style := tcell.StyleDefault. - Foreground(tcell.ColorDefault). - Background(tcell.ColorDefault) - - f.term.SetContent(w, h, ' ', nil, style) + f.term.setCell(w, h, ' ', termbox.ColorDefault, termbox.ColorDefault) w++ default: // Preview text if h-1 >= len(prevLines) { @@ -335,21 +274,13 @@ func (f *finder) _drawPreview() { } rw := runewidth.RuneWidth(l[j]) if w+rw > width-1-2 { - style := tcell.StyleDefault. - Foreground(tcell.ColorDefault). - Background(tcell.ColorDefault) - - f.term.SetContent(w, h, '.', nil, style) - f.term.SetContent(w+1, h, '.', nil, style) - + f.term.setCell(w, h, '.', termbox.ColorDefault, termbox.ColorDefault) + f.term.setCell(w+1, h, '.', termbox.ColorDefault, termbox.ColorDefault) w += 2 continue } - style := tcell.StyleDefault. - Foreground(tcell.ColorDefault). - Background(tcell.ColorDefault) - f.term.SetContent(w, h, l[j], nil, style) + f.term.setCell(w, h, l[j], termbox.ColorDefault, termbox.ColorDefault) w += rw } } @@ -364,7 +295,7 @@ func (f *finder) draw(d time.Duration) { // Don't use goroutine scheduling. f._draw() f._drawPreview() - f.term.Show() + f.term.flush() } else { f.drawTimer.Reset(d) } @@ -386,16 +317,16 @@ func (f *finder) readKey() error { } }() - e := f.term.PollEvent() + e := f.term.pollEvent() f.stateMu.Lock() defer f.stateMu.Unlock() - switch e := e.(type) { - case *tcell.EventKey: - switch e.Key() { - case tcell.KeyEsc, tcell.KeyCtrlC, tcell.KeyCtrlD: + switch e.Type { + case termbox.EventKey: + switch e.Key { + case termbox.KeyEsc, termbox.KeyCtrlC, termbox.KeyCtrlD: return ErrAbort - case tcell.KeyBackspace, tcell.KeyBackspace2: + case termbox.KeyBackspace, termbox.KeyBackspace2: if len(f.state.input) == 0 { return nil } @@ -406,32 +337,32 @@ func (f *finder) readKey() error { f.state.cursorX -= runewidth.RuneWidth(f.state.input[x-1]) f.state.x-- f.state.input = append(f.state.input[:x-1], f.state.input[x:]...) - case tcell.KeyDelete: + case termbox.KeyDelete: if f.state.x == len(f.state.input) { return nil } x := f.state.x f.state.input = append(f.state.input[:x], f.state.input[x+1:]...) - case tcell.KeyEnter: + case termbox.KeyEnter: return errEntered - case tcell.KeyLeft, tcell.KeyCtrlB: + case termbox.KeyArrowLeft, termbox.KeyCtrlB: if f.state.x > 0 { f.state.cursorX -= runewidth.RuneWidth(f.state.input[f.state.x-1]) f.state.x-- } - case tcell.KeyRight, tcell.KeyCtrlF: + case termbox.KeyArrowRight, termbox.KeyCtrlF: if f.state.x < len(f.state.input) { f.state.cursorX += runewidth.RuneWidth(f.state.input[f.state.x]) f.state.x++ } - case tcell.KeyCtrlA: + case termbox.KeyCtrlA: f.state.cursorX = 0 f.state.x = 0 - case tcell.KeyCtrlE: + case termbox.KeyCtrlE: f.state.cursorX = runewidth.StringWidth(string(f.state.input)) f.state.x = len(f.state.input) - case tcell.KeyCtrlW: + case termbox.KeyCtrlW: in := f.state.input[:f.state.x] inStr := string(in) pos := strings.LastIndex(strings.TrimRightFunc(inStr, unicode.IsSpace), " ") @@ -446,26 +377,26 @@ func (f *finder) readKey() error { f.state.input = newIn f.state.cursorX = runewidth.StringWidth(string(newIn)) f.state.x = len(newIn) - case tcell.KeyCtrlU: + case termbox.KeyCtrlU: f.state.input = f.state.input[f.state.x:] f.state.cursorX = 0 f.state.x = 0 - case tcell.KeyUp, tcell.KeyCtrlK, tcell.KeyCtrlP: + case termbox.KeyArrowUp, termbox.KeyCtrlK, termbox.KeyCtrlP: if f.state.y+1 < len(f.state.matched) { f.state.y++ } - _, height := f.term.Size() + _, height := f.term.size() if f.state.cursorY+1 < height-2 && f.state.cursorY+1 < len(f.state.matched) { f.state.cursorY++ } - case tcell.KeyDown, tcell.KeyCtrlJ, tcell.KeyCtrlN: + case termbox.KeyArrowDown, termbox.KeyCtrlJ, termbox.KeyCtrlN: if f.state.y > 0 { f.state.y-- } if f.state.cursorY-1 >= 0 { f.state.cursorY-- } - case tcell.KeyTab: + case termbox.KeyTab: if !f.opt.multi { return nil } @@ -483,8 +414,11 @@ func (f *finder) readKey() error { f.state.cursorY-- } default: - if e.Rune() != 0 { - width, _ := f.term.Size() + if e.Key == termbox.KeySpace { + e.Ch = ' ' + } + if e.Ch != 0 { + width, _ := f.term.size() maxLineWidth := width - 2 - 1 if len(f.state.input)+1 > maxLineWidth { // Discard inputted rune. @@ -492,15 +426,17 @@ func (f *finder) readKey() error { } x := f.state.x - f.state.input = append(f.state.input[:x], append([]rune{e.Rune()}, f.state.input[x:]...)...) - f.state.cursorX += runewidth.RuneWidth(e.Rune()) + f.state.input = append(f.state.input[:x], append([]rune{e.Ch}, f.state.input[x:]...)...) + f.state.cursorX += runewidth.RuneWidth(e.Ch) f.state.x++ } } - case *tcell.EventResize: - f.term.Clear() + case termbox.EventResize: + // To get the actual window size, clear all buffers. + // See termbox.Clear's documentation for more details. + _ = f.term.clear(termbox.ColorDefault, termbox.ColorDefault) - width, height := f.term.Size() + width, height := f.term.size() itemAreaHeight := height - 2 - 1 if itemAreaHeight >= 0 && f.state.cursorY > itemAreaHeight { f.state.cursorY = itemAreaHeight @@ -620,10 +556,7 @@ func (f *finder) find(slice interface{}, itemFunc func(i int) string, opts []Opt if err := f.initFinder(items, matched, opt); err != nil { return nil, errors.Wrap(err, "failed to initialize the fuzzy finder") } - - if !isInTesting() { - defer f.term.Fini() - } + defer f.term.close() close(inited) @@ -643,10 +576,6 @@ func (f *finder) find(slice interface{}, itemFunc func(i int) string, opts []Opt f.draw(10 * time.Millisecond) err := f.readKey() - // hack for earning time to filter exec - if isInTesting() { - time.Sleep(50 * time.Millisecond) - } switch { case errors.Is(err, ErrAbort): return nil, ErrAbort @@ -678,21 +607,6 @@ func (f *finder) find(slice interface{}, itemFunc func(i int) string, opts []Opt } } -// This method avoid tcell bug https://github.com/gdamore/tcell/issues/194 -// Additional EOL event is sent to ensure, consequent events, are correctly handled. -func sendExtraEventFix() error { - kb, err := keybd_event.NewKeyBonding() - if err != nil { - return err - } - kb.SetKeys(keybd_event.VK_ENTER) - err = kb.Launching() - if err != nil { - return err - } - return nil -} - // Find displays a UI that provides fuzzy finding against the provided slice. // The argument slice must be of a slice type. If not, Find returns // an error. itemFunc is called by the length of slice. previewFunc is called @@ -709,12 +623,6 @@ func Find(slice interface{}, itemFunc func(i int) string, opts ...Option) (int, func (f *finder) Find(slice interface{}, itemFunc func(i int) string, opts ...Option) (int, error) { res, err := f.find(slice, itemFunc, opts) - if !isInTesting() { - if err := sendExtraEventFix(); err != nil { - return 0, err - } - } - if err != nil { return 0, err } @@ -729,13 +637,7 @@ func FindMulti(slice interface{}, itemFunc func(i int) string, opts ...Option) ( func (f *finder) FindMulti(slice interface{}, itemFunc func(i int) string, opts ...Option) ([]int, error) { opts = append(opts, withMulti()) - res, err := f.find(slice, itemFunc, opts) - if !isInTesting() { - if err := sendExtraEventFix(); err != nil { - return nil, err - } - } - return res, err + return f.find(slice, itemFunc, opts) } func isInTesting() bool { diff --git a/fuzzyfinder_test.go b/fuzzyfinder_test.go index fc0f7ec..7ebc564 100644 --- a/fuzzyfinder_test.go +++ b/fuzzyfinder_test.go @@ -12,9 +12,9 @@ import ( "testing" "time" - "github.com/gdamore/tcell/v2" "github.com/google/go-cmp/cmp" fuzzyfinder "github.com/ktr0731/go-fuzzyfinder" + "github.com/nsf/termbox-go" "github.com/pkg/errors" ) @@ -119,85 +119,38 @@ func TestReal(t *testing.T) { func TestFind(t *testing.T) { cases := map[string]struct { - events []tcell.Event + events []termbox.Event }{ - "initial": {}, - "input lo": {runes("lo")}, - "input glow": {runes("glow")}, - "arrow up-down": {keys([]input{ - {tcell.KeyUp, rune(tcell.KeyUp), tcell.ModNone}, - {tcell.KeyUp, rune(tcell.KeyUp), tcell.ModNone}, - {tcell.KeyDown, rune(tcell.KeyDown), tcell.ModNone}, - }...)}, - "arrow left-right": {append(runes("ゆるふわ樹海"), keys([]input{ - {tcell.KeyLeft, rune(tcell.KeyLeft), tcell.ModNone}, - {tcell.KeyLeft, rune(tcell.KeyLeft), tcell.ModNone}, - {tcell.KeyRight, rune(tcell.KeyRight), tcell.ModNone}, - }...)...)}, - "backspace": {append(runes("adr .-"), keys([]input{ - {tcell.KeyBackspace, rune(tcell.KeyBackspace), tcell.ModNone}, - {tcell.KeyBackspace, rune(tcell.KeyBackspace), tcell.ModNone}, - }...)...)}, - "backspace empty": {keys(input{tcell.KeyBackspace2, rune(tcell.KeyBackspace2), tcell.ModNone})}, - "backspace2": {append(runes("オレンジ"), keys([]input{ - {tcell.KeyBackspace2, rune(tcell.KeyBackspace2), tcell.ModNone}, - {tcell.KeyBackspace2, rune(tcell.KeyBackspace2), tcell.ModNone}, - }...)...)}, - "arrow left backspace": {append(runes("オレンジ"), keys([]input{ - {tcell.KeyLeft, rune(tcell.KeyLeft), tcell.ModNone}, - {tcell.KeyBackspace, rune(tcell.KeyBackspace), tcell.ModNone}, - }...)...)}, - "delete": {append(runes("オレンジ"), keys([]input{ - {tcell.KeyCtrlA, 'A', tcell.ModCtrl}, - {tcell.KeyDelete, rune(tcell.KeyDelete), tcell.ModNone}, - }...)...)}, - "delete empty": {keys([]input{ - {tcell.KeyCtrlA, 'A', tcell.ModCtrl}, - {tcell.KeyDelete, rune(tcell.KeyDelete), tcell.ModNone}, - }...)}, - "ctrl-e": {append(runes("恋をしたのは"), keys([]input{ - {tcell.KeyCtrlA, 'A', tcell.ModCtrl}, - {tcell.KeyCtrlE, 'E', tcell.ModCtrl}, - }...)...)}, - "ctrl-w": {append(runes("ハロ / ハワユ"), keys(input{tcell.KeyCtrlW, 'W', tcell.ModCtrl})...)}, - "ctrl-w empty": {keys(input{tcell.KeyCtrlW, 'W', tcell.ModCtrl})}, - "ctrl-u": {append(runes("恋をしたのは"), keys([]input{ - {tcell.KeyLeft, rune(tcell.KeyLeft), tcell.ModNone}, - {tcell.KeyCtrlU, 'U', tcell.ModCtrl}, - {tcell.KeyRight, rune(tcell.KeyRight), tcell.ModNone}, - }...)...)}, - "long item": {keys([]input{ - {tcell.KeyUp, rune(tcell.KeyUp), tcell.ModNone}, - {tcell.KeyUp, rune(tcell.KeyUp), tcell.ModNone}, - {tcell.KeyUp, rune(tcell.KeyUp), tcell.ModNone}, - }...)}, - "paging": {keys([]input{ - {tcell.KeyUp, rune(tcell.KeyUp), tcell.ModNone}, - {tcell.KeyUp, rune(tcell.KeyUp), tcell.ModNone}, - {tcell.KeyUp, rune(tcell.KeyUp), tcell.ModNone}, - {tcell.KeyUp, rune(tcell.KeyUp), tcell.ModNone}, - {tcell.KeyUp, rune(tcell.KeyUp), tcell.ModNone}, - {tcell.KeyUp, rune(tcell.KeyUp), tcell.ModNone}, - {tcell.KeyUp, rune(tcell.KeyUp), tcell.ModNone}, - {tcell.KeyUp, rune(tcell.KeyUp), tcell.ModNone}, - }...)}, - "tab doesn't work": {keys(input{tcell.KeyTab, rune(tcell.KeyTab), tcell.ModNone})}, - "backspace doesnt change x if cursorX is 0": {append(runes("a"), keys([]input{ - {tcell.KeyCtrlA, 'A', tcell.ModCtrl}, - {tcell.KeyBackspace, rune(tcell.KeyBackspace), tcell.ModNone}, - {tcell.KeyCtrlF, 'F', tcell.ModCtrl}, - }...)...)}, + "initial": {}, + "input lo": {runes("lo")}, + "input glow": {runes("glow")}, + "arrow up-down": {keys(termbox.KeyArrowUp, termbox.KeyArrowUp, termbox.KeyArrowDown)}, + "arrow left-right": {append(runes("ゆるふわ樹海ガール"), keys(termbox.KeyArrowLeft, termbox.KeyArrowLeft, termbox.KeyArrowLeft, termbox.KeyArrowRight)...)}, + "backspace": {append(runes("adrenaline!!! -TV Ver.-"), keys(termbox.KeyBackspace, termbox.KeyBackspace, termbox.KeyArrowLeft, termbox.KeyArrowLeft, termbox.KeyBackspace)...)}, + "backspace empty": {keys(termbox.KeyBackspace2, termbox.KeyBackspace2)}, + "backspace2": {append(runes("オレンジ"), keys(termbox.KeyBackspace2, termbox.KeyBackspace2)...)}, + "delete": {append(runes("オレンジ"), keys(termbox.KeyCtrlA, termbox.KeyDelete)...)}, + "delete empty": {keys(termbox.KeyCtrlA, termbox.KeyDelete)}, + "ctrl-e": {append(runes("恋をしたのは"), keys(termbox.KeyCtrlA, termbox.KeyCtrlE)...)}, + "ctrl-w": {append(runes("ハロ / ハワユ"), key(termbox.KeyCtrlW))}, + "ctrl-w emtpy": {keys(termbox.KeyCtrlW)}, + "ctrl-u": {append(runes("恋をしたのは"), keys(termbox.KeyArrowLeft, termbox.KeyCtrlU, termbox.KeyArrowRight)...)}, + "long item": {keys(termbox.KeyArrowUp, termbox.KeyArrowUp, termbox.KeyArrowUp)}, + "paging": {keys(termbox.KeyArrowUp, termbox.KeyArrowUp, termbox.KeyArrowUp, termbox.KeyArrowUp, termbox.KeyArrowUp, termbox.KeyArrowUp, termbox.KeyArrowUp, termbox.KeyArrowUp)}, + "tab doesn't work": {keys(termbox.KeyTab)}, + "backspace doesnt change x if cursorX is 0": {append(runes("a"), keys(termbox.KeyCtrlA, termbox.KeyBackspace, termbox.KeyCtrlF)...)}, } for name, c := range cases { c := c t.Run(name, func(t *testing.T) { + c := c events := c.events f, term := fuzzyfinder.NewWithMockedTerminal() - events = append(events, key(input{tcell.KeyEsc, rune(tcell.KeyEsc), tcell.ModNone})) - term.SetEventsV2(events...) + events = append(events, key(termbox.KeyEsc)) + term.SetEvents(events...) assertWithGolden(t, func(t *testing.T) string { _, err := f.Find( @@ -217,8 +170,7 @@ func TestFind(t *testing.T) { t.Fatalf("Find must return ErrAbort, but got '%s'", err) } - res := term.GetResult() - return res + return term.GetResult() }) }) } @@ -226,8 +178,8 @@ func TestFind(t *testing.T) { func TestFind_hotReload(t *testing.T) { f, term := fuzzyfinder.NewWithMockedTerminal() - events := append(runes("adrena"), keys(input{tcell.KeyEsc, rune(tcell.KeyEsc), tcell.ModNone})...) - term.SetEventsV2(events...) + events := append(runes("adrena"), keys(termbox.KeyEsc)...) + term.SetEvents(events...) var mu sync.Mutex assertWithGolden(t, func(t *testing.T) string { @@ -255,18 +207,17 @@ func TestFind_hotReload(t *testing.T) { t.Fatalf("Find must return ErrAbort, but got '%s'", err) } - res := term.GetResult() - return res + return term.GetResult() }) } func TestFind_enter(t *testing.T) { cases := map[string]struct { - events []tcell.Event + events []termbox.Event expected int }{ - "initial": {events: keys(input{tcell.KeyTab, rune(tcell.KeyTab), tcell.ModNone}), expected: 0}, - "mode smart to case-sensitive": {events: runes("JI"), expected: 7}, + "initial": {events: keys(termbox.KeyTab), expected: 0}, + "mode smart to case-sensitive": {events: runes("CHI"), expected: 7}, } for name, c := range cases { @@ -276,8 +227,8 @@ func TestFind_enter(t *testing.T) { events := c.events f, term := fuzzyfinder.NewWithMockedTerminal() - events = append(events, key(input{tcell.KeyEnter, rune(tcell.KeyEnter), tcell.ModNone})) - term.SetEventsV2(events...) + events = append(events, key(termbox.KeyEnter)) + term.SetEvents(events...) idx, err := f.Find( tracks, @@ -285,7 +236,6 @@ func TestFind_enter(t *testing.T) { return tracks[i].Name }, ) - if err != nil { t.Fatalf("Find must not return an error, but got '%s'", err) } @@ -316,29 +266,16 @@ func TestFind_error(t *testing.T) { func TestFindMulti(t *testing.T) { cases := map[string]struct { - events []tcell.Event + events []termbox.Event expected []int abort bool }{ - "input glow": {events: runes("glow"), expected: []int{0}}, - "select two items": {events: keys([]input{ - {tcell.KeyTab, rune(tcell.KeyTab), tcell.ModNone}, - {tcell.KeyUp, rune(tcell.KeyUp), tcell.ModNone}, - {tcell.KeyTab, rune(tcell.KeyTab), tcell.ModNone}, - }...), expected: []int{0, 1}}, - "select two items with another order": {events: keys([]input{ - {tcell.KeyUp, rune(tcell.KeyUp), tcell.ModNone}, - {tcell.KeyTab, rune(tcell.KeyTab), tcell.ModNone}, - {tcell.KeyTab, rune(tcell.KeyTab), tcell.ModNone}, - }...), expected: []int{1, 0}}, - "toggle": {events: keys([]input{ - {tcell.KeyTab, rune(tcell.KeyTab), tcell.ModNone}, - {tcell.KeyTab, rune(tcell.KeyTab), tcell.ModNone}, - }...), expected: []int{0}}, - "empty result": {events: runes("fffffff"), abort: true}, - "resize window": {events: []tcell.Event{ - tcell.NewEventResize(10, 10), - }, expected: []int{0}}, + "input glow": {events: runes("glow"), expected: []int{0}}, + "select two items": {events: keys(termbox.KeyTab, termbox.KeyArrowUp, termbox.KeyTab), expected: []int{0, 1}}, + "select two items with another order": {events: keys(termbox.KeyArrowUp, termbox.KeyTab, termbox.KeyTab), expected: []int{1, 0}}, + "toggle": {events: keys(termbox.KeyTab, termbox.KeyTab), expected: []int{0}}, + "empty result": {events: runes("ffffffffffffff"), abort: true}, + "resize window": {events: []termbox.Event{termbox.Event{Type: termbox.EventResize}}, expected: []int{0}}, } for name, c := range cases { c := c @@ -347,8 +284,8 @@ func TestFindMulti(t *testing.T) { events := c.events f, term := fuzzyfinder.NewWithMockedTerminal() - events = append(events, key(input{tcell.KeyEnter, rune(tcell.KeyEnter), tcell.ModNone})) - term.SetEventsV2(events...) + events = append(events, key(termbox.KeyEnter)) + term.SetEvents(events...) idxs, err := f.FindMulti( tracks, @@ -385,9 +322,7 @@ func BenchmarkFind(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { f, term := fuzzyfinder.NewWithMockedTerminal() - events := append(runes("adrele!!"), key(input{tcell.KeyEsc, rune(tcell.KeyEsc), tcell.ModNone})) - term.SetEventsV2(events...) - + term.SetEvents(append(runes("adrele!!"), key(termbox.KeyEsc))...) _, err := f.Find( tracks, func(i int) string { @@ -411,9 +346,7 @@ func BenchmarkFind(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { f, term := fuzzyfinder.NewWithMockedTerminal() - events := append(runes("adrele!!"), key(input{tcell.KeyEsc, rune(tcell.KeyEsc), tcell.ModNone})) - term.SetEventsV2(events...) - + term.SetEvents(append(runes("adrele!!"), key(termbox.KeyEsc))...) _, err := f.Find( &tracks, func(i int) string { @@ -434,33 +367,36 @@ func BenchmarkFind(b *testing.B) { }) } -func runes(s string) []tcell.Event { +func runes(s string) []termbox.Event { r := []rune(s) - e := make([]tcell.Event, 0, len(r)) + e := make([]termbox.Event, 0, len(r)) for _, r := range r { e = append(e, ch(r)) } return e } -func ch(r rune) tcell.Event { - return key(input{tcell.KeyRune, r, tcell.ModNone}) +func ch(r rune) termbox.Event { + if r == ' ' { + return key(termbox.KeySpace) + } + return termbox.Event{ + Type: termbox.EventKey, + Ch: r, + } } -func key(input input) tcell.Event { - return tcell.NewEventKey(input.key, input.ch, input.mod) +func key(key termbox.Key) termbox.Event { + return termbox.Event{ + Type: termbox.EventKey, + Key: key, + } } -func keys(inputs ...input) []tcell.Event { - k := make([]tcell.Event, 0, len(inputs)) - for _, in := range inputs { - k = append(k, key(in)) +func keys(keys ...termbox.Key) []termbox.Event { + k := make([]termbox.Event, 0, len(keys)) + for _, _key := range keys { + k = append(k, key(_key)) } return k } - -type input struct { - key tcell.Key - ch rune - mod tcell.ModMask -} diff --git a/go.mod b/go.mod index 423d691..62c94f1 100644 --- a/go.mod +++ b/go.mod @@ -2,19 +2,13 @@ module github.com/ktr0731/go-fuzzyfinder require ( github.com/Songmu/gocredits v0.2.0 - github.com/gdamore/tcell/v2 v2.1.0 github.com/golangci/golangci-lint v1.35.2 github.com/google/go-cmp v0.5.4 github.com/google/gofuzz v1.2.0 - github.com/goreleaser/goreleaser v0.149.0 // indirect - github.com/kisielk/godepgraph v0.0.0-20190626013829-57a7e4a651a9 // indirect - github.com/ktr0731/bump v0.1.0 // indirect - github.com/matryer/moq v0.1.4 // indirect + github.com/goreleaser/goreleaser v0.149.0 github.com/mattn/go-runewidth v0.0.10 - github.com/micmonay/keybd_event v1.1.0 github.com/nsf/termbox-go v0.0.0-20201124104050-ed494de23a00 github.com/pkg/errors v0.9.1 - golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect ) go 1.13 diff --git a/go.sum b/go.sum index 29ce6ef..cf73b94 100644 --- a/go.sum +++ b/go.sum @@ -24,14 +24,17 @@ cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNF cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0 h1:PQcPefKFdaIzjQFbiyOgAqyx8q5djaE7x9Sqe712DPA= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0 h1:/May9ojXjRkPBNVrq+oWLqmWCkr4OU5uRY29bu0mRyQ= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/firestore v1.2.0/go.mod h1:iISCjWnTpnoJT1R287xRdjvQHJrxQOpeah4phb5D3h0= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1 h1:ukjixP1wl0LpnZ6LWtZJ0mX5tBmjp1f8Sqer8Z2OMUU= cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= @@ -74,6 +77,7 @@ github.com/Azure/go-autorest/autorest/date v0.2.0 h1:yW+Zlqf26583pE43KhfnhFcdmSW github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g= github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= +github.com/Azure/go-autorest/autorest/mocks v0.3.0 h1:qJumjCaCudz+OcqE9/XtEPfvtOjOmKaui4EOpFI6zZc= github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM= github.com/Azure/go-autorest/autorest/to v0.3.0 h1:zebkZaadz7+wIQYgC7GXaz3Wb28yKYfVkkBKwc38VF8= github.com/Azure/go-autorest/autorest/to v0.3.0/go.mod h1:MgwOyqaIuKdG4TL/2ywSsIWKAfJfgHDo8ObuUk3t5sA= @@ -99,6 +103,7 @@ github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0 github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60= github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= +github.com/Microsoft/go-winio v0.4.15 h1:qkLXKzb1QoVatRyd/YlXZ/Kg0m5K3SPuoD82jjSOaBc= github.com/Microsoft/go-winio v0.4.15/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OpenPeeDeeP/depguard v1.0.1 h1:VlW4R6jmBIv3/u1JNlawEvJMM4J+dPORPaZasQee8Us= @@ -106,6 +111,7 @@ github.com/OpenPeeDeeP/depguard v1.0.1/go.mod h1:xsIw86fROiiwelg+jB2uM9PiKihMMmU github.com/Songmu/gocredits v0.2.0 h1:AbvFKEbwP5/0qisF0cTlUwVuCtzbJG+ynsXuEUC98vI= github.com/Songmu/gocredits v0.2.0/go.mod h1:JBywHzwOmBMF9uidu1EgS3mwVNqZCKOPLPrFd1h7qQo= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= +github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7 h1:uSoVVbwJiQipAclBbw+8quDsfcvFjOpI5iCf4p/cqCs= github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs= github.com/alecthomas/kingpin v2.2.6+incompatible/go.mod h1:59OFYbFVLKQKq+mqrL6Rw5bR0c3ACQaawgXx0QYndlE= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -113,6 +119,7 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= +github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/apex/log v1.9.0 h1:FHtw/xuaM8AgmvDDTI9fiwoAL25Sq2cxojnZICUU8l0= github.com/apex/log v1.9.0/go.mod h1:m82fZlWIuiWzWP04XCTXmnX0xRkYYbCdYn8jbJeLBEA= @@ -122,8 +129,11 @@ github.com/aphistic/sweet v0.2.0/go.mod h1:fWDlIh/isSE9n6EPsRmC0det+whmX6dJid3st github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= +github.com/ashanbrown/forbidigo v1.0.0 h1:QdNXBduDUopc3GW+YVYZn8jzmIMklQiCfdN2N5+dQeE= github.com/ashanbrown/forbidigo v1.0.0/go.mod h1:PH+zMRWE15yW69fYfe7Kn8nYR6yYyafc3ntEGh2BBAg= +github.com/ashanbrown/makezero v0.0.0-20201205152432-7b7cdbb3025a h1:/U9tbJzDRof4fOR51vwzWdIBsIH6R2yU0KG1MBRM2Js= github.com/ashanbrown/makezero v0.0.0-20201205152432-7b7cdbb3025a/go.mod h1:oG9Dnez7/ESBqc4EdrdNlryeo7d0KcW1ftXHm7nU/UU= github.com/aws/aws-sdk-go v1.15.27/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= github.com/aws/aws-sdk-go v1.19.18/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= @@ -151,6 +161,7 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= @@ -160,15 +171,14 @@ github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7 github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/daixiang0/gci v0.2.4 h1:BUCKk5nlK2m+kRIsoj+wb/5hazHvHeZieBKWd9Afa8Q= github.com/daixiang0/gci v0.2.4/go.mod h1:+AV8KmHTGxxwp/pY84TLQfFKp2vuKXXJVzF3kD/hfR4= -github.com/daixiang0/gci v0.2.7/go.mod h1:+4dZ7TISfSmqfAGv59ePaHfNzgGtIkHAhhdKggP1JAc= +github.com/daixiang0/gci v0.2.8 h1:1mrIGMBQsBu0P7j7m1M8Lb+ZeZxsZL+jyGX4YoMJJpg= github.com/daixiang0/gci v0.2.8/go.mod h1:+4dZ7TISfSmqfAGv59ePaHfNzgGtIkHAhhdKggP1JAc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/denis-tingajkin/go-header v0.3.1 h1:ymEpSiFjeItCy1FOP+x0M2KdCELdEAHUsNa8F+hHc6w= github.com/denis-tingajkin/go-header v0.3.1/go.mod h1:sq/2IxMhaZX+RRcgHfCRx/m0M5na0fBt4/CRe7Lrji0= +github.com/denis-tingajkin/go-header v0.4.2 h1:jEeSF4sdv8/3cT/WY8AgDHUoItNSoEZ7qg9dX7pc218= github.com/denis-tingajkin/go-header v0.4.2/go.mod h1:eLRHAVXzE5atsKAnNRDB90WHCFFnBUn4RN0nRcs1LJA= github.com/devigned/tab v0.1.1/go.mod h1:XG9mPq0dFghrYvoBF3xdRrJzSTX1b7IQrvaL9mzjeJY= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= @@ -186,25 +196,23 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko= -github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg= -github.com/gdamore/tcell/v2 v2.0.0 h1:GRWG8aLfWAlekj9Q6W29bVvkHENc6hp79XOqG4AWDOs= -github.com/gdamore/tcell/v2 v2.0.0/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA= -github.com/gdamore/tcell/v2 v2.1.0/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= -github.com/go-critic/go-critic v0.5.2 h1:3RJdgf6u4NZUumoP8nzbqiiNT8e1tC2Oc7jlgqre/IA= github.com/go-critic/go-critic v0.5.2/go.mod h1:cc0+HvdE3lFpqLecgqMaJcvWWH77sLdBp+wLGPM1Yyo= +github.com/go-critic/go-critic v0.5.3 h1:xQEweNxzBNpSqI3wotXZAixRarETng3PTG4pkcrLCOA= github.com/go-critic/go-critic v0.5.3/go.mod h1:2Lrs1m4jtOnnG/EdezbSpAoL0F2pRW+9HWJUZ+QaktY= github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= github.com/go-git/go-billy/v5 v5.0.0 h1:7NQHvd9FVid8VL4qVUMm8XifBK+2xCoZ2lSk0agRrHM= github.com/go-git/go-billy/v5 v5.0.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= +github.com/go-git/go-git-fixtures/v4 v4.0.2-0.20200613231340-f56387b50c12 h1:PbKy9zOy4aAKrJ5pibIRpVO2BXnK1Tlcg+caKI7Ox5M= github.com/go-git/go-git-fixtures/v4 v4.0.2-0.20200613231340-f56387b50c12/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1C+ZpZcrJjappBCDSw= github.com/go-git/go-git/v5 v5.2.0 h1:YPBLG/3UK1we1ohRkncLjaXWLW+HKp5QNM/jTli2JgI= github.com/go-git/go-git/v5 v5.2.0/go.mod h1:kh02eMX+wdqqxgNMEyq8YgwlIOsDOa9homkUq1PoTMs= @@ -230,6 +238,7 @@ github.com/go-toolsmith/astfmt v1.0.0/go.mod h1:cnWmsOAuq4jJY6Ct5YWlVLmcmLMn1JUP github.com/go-toolsmith/astinfo v0.0.0-20180906194353-9809ff7efb21/go.mod h1:dDStQCHtmZpYOmjRP/8gHHnCCch3Zz3oEgCdZVdtweU= github.com/go-toolsmith/astp v1.0.0 h1:alXE75TXgcmupDsMK1fRAy0YUzLzqPVvBKoyWV+KPXg= github.com/go-toolsmith/astp v1.0.0/go.mod h1:RSyrtpVlfTFGDYRbrjyWP1pYu//tSFcvdYrA8meBmLI= +github.com/go-toolsmith/pkgload v1.0.0 h1:4DFWWMXVfbcN5So1sBNW9+yeiMqLFGl1wFLTL5R0Tgg= github.com/go-toolsmith/pkgload v1.0.0/go.mod h1:5eFArkbO80v7Z0kdngIxsRXRMTaX4Ilcwuh3clNrQJc= github.com/go-toolsmith/strparse v1.0.0 h1:Vcw78DnpCAKlM20kSbAyO4mPfJn/lyYA4BJUDxe2Jb4= github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8= @@ -282,11 +291,8 @@ github.com/golangci/gocyclo v0.0.0-20180528144436-0a533e8fa43d h1:pXTK/gkVNs7Zyy github.com/golangci/gocyclo v0.0.0-20180528144436-0a533e8fa43d/go.mod h1:ozx7R9SIwqmqf5pRP90DhR2Oay2UIjGuKheCBCNwAYU= github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a h1:iR3fYXUjHCR97qWS8ch1y9zPNsgXThGwjKPrYfqMPks= github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a/go.mod h1:9qCChq59u/eW8im404Q2WWTrnBUQKjpNYKMbU4M7EFU= -github.com/golangci/golangci-lint v1.33.0 h1:/o4OtOR3Idim4FHKBJXcy+6ZjNDm82gwK/v6+gWyH9U= github.com/golangci/golangci-lint v1.33.0/go.mod h1:zMnMLSCaDlrXExYsuq2LOweE9CHVqYk5jexk23UsjYM= -github.com/golangci/golangci-lint v1.34.0/go.mod h1:6Bnn7T0JYin7uukitgL6f9E9auQatlT0RMNOKG9lSHU= -github.com/golangci/golangci-lint v1.34.1/go.mod h1:6Bnn7T0JYin7uukitgL6f9E9auQatlT0RMNOKG9lSHU= -github.com/golangci/golangci-lint v1.35.0/go.mod h1:NiYRUy48EnouB+hqETOzNyFTxHO8NYra1t7OGDkDMWg= +github.com/golangci/golangci-lint v1.35.2 h1:hD1999/sq3tCPXhhI4UpunxpAAdH9pK7kDIObqoGuWA= github.com/golangci/golangci-lint v1.35.2/go.mod h1:Sg5fFp5oLLI1B8gXfUVUSePju8XF0uWefMkuZuGIHUo= github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc h1:gLLhTLMk2/SutryVJ6D4VZCU3CUqr8YloG7FPIBWFpI= github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc/go.mod h1:e5tpTHCfVze+7EpLEozzMB3eafxo2KT5veNg1k6byQU= @@ -311,18 +317,20 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-github/v28 v28.1.1 h1:kORf5ekX5qwXO2mGzXXOjMe/g6ap8ahVe0sBEulhSxo= github.com/google/go-github/v28 v28.1.1/go.mod h1:bsqJWQX05omyWVmc00nEUql9mhQyv38lDZ8kPZcQVoM= github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= +github.com/google/go-replayers/grpcreplay v0.1.0 h1:eNb1y9rZFmY4ax45uEEECSa8fsxGRU+8Bil52ASAwic= github.com/google/go-replayers/grpcreplay v0.1.0/go.mod h1:8Ig2Idjpr6gifRd6pNVggX6TC1Zw6Jx74AKp7QNH2QE= +github.com/google/go-replayers/httpreplay v0.1.0 h1:AX7FUb4BjrrzNvblr/OlgwrmFiep6soj5K2QSDW7BGk= github.com/google/go-replayers/httpreplay v0.1.0/go.mod h1:YKZViNhiGgqdBlUbI2MwGpq4pXxNmhJLPHQ7cv2b5no= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian v2.1.1-0.20190517191504-25dcb96d9e51+incompatible h1:xmapqc1AyLoB+ddYT6r04bD9lIjlOqGaREovi0SzFaE= github.com/google/martian v2.1.1-0.20190517191504-25dcb96d9e51+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -347,6 +355,7 @@ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+ github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gookit/color v1.3.1/go.mod h1:R3ogXq2B9rTbXoSHJ1HyUVAZ3poOJHpd9nQmyGZsfvQ= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/goreleaser/chglog v0.1.2 h1:tdzAb/ILeMnphzI9zQ7Nkq+T8R9qyXli8GydD8plFRY= github.com/goreleaser/chglog v0.1.2/go.mod h1:tTZsFuSZK4epDXfjMkxzcGbrIOXprf0JFp47BjIr3B8= @@ -359,11 +368,11 @@ github.com/goreleaser/nfpm v1.10.2/go.mod h1:R3sQteLUCtPD7GJxvDl0eqlkTX0/hqFftT3 github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= github.com/gostaticanalysis/analysisutil v0.0.3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= -github.com/gostaticanalysis/analysisutil v0.1.0 h1:E4c8Y1EQURbBEAHoXc/jBTK7Np14ArT8NPUiSFOl9yc= github.com/gostaticanalysis/analysisutil v0.1.0/go.mod h1:dMhHRU9KTiDcuLGdy87/2gTR8WruwYZrKdRq9m1O6uw= +github.com/gostaticanalysis/analysisutil v0.4.1 h1:/7clKqrVfiVwiBQLM0Uke4KvXnO6JcCTS7HwF2D6wG8= github.com/gostaticanalysis/analysisutil v0.4.1/go.mod h1:18U/DLpRgIUd459wGxVHE0fRgmo1UgHDcbw7F5idXu0= -github.com/gostaticanalysis/comment v1.3.0 h1:wTVgynbFu8/nz6SGgywA0TcyIoAVsYc7ai/Zp5xNGlw= github.com/gostaticanalysis/comment v1.3.0/go.mod h1:xMicKDx7XRXYdVwY9f9wQpDJVnqWxw9wCauCMKp+IBI= +github.com/gostaticanalysis/comment v1.4.1 h1:xHopR5L2lRz6OsjH4R2HG5wRhW9ySl3FsHIvi5pcXwc= github.com/gostaticanalysis/comment v1.4.1/go.mod h1:ih6ZxzTHLdadaiSnF5WY3dxUoXfXAlTaRzuaNDlSado= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= @@ -373,6 +382,7 @@ github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyN github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI= github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= @@ -384,8 +394,6 @@ github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerX github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.0.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.2.1 h1:zEfKbn2+PDgroKdiOzqiE8rsmLqU2uwi5PB5pBJ3TkI= github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= @@ -405,7 +413,9 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1: github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA= github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jarcoal/httpmock v1.0.6 h1:e81vOSexXU3mJuJ4l//geOmKIt+Vkxerk1feQBC8D0g= github.com/jarcoal/httpmock v1.0.6/go.mod h1:ATjnClrvW/3tijVmpL/va5Z3aAyGvqU3gCT8nX0Txik= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= @@ -427,15 +437,15 @@ github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22 github.com/jpillora/backoff v0.0.0-20180909062703-3050d21c67d7/go.mod h1:2iMrUgbbvHEiQClaW2NsSzMyGHqN+rDFqY705q49KG0= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1 h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 h1:DowS9hvgyYSX4TO5NpyC606/Z4SxnNYbT+WX27or6Ck= github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/godepgraph v0.0.0-20190626013829-57a7e4a651a9 h1:ZkWH0x1yafBo+Y2WdGGdszlJrMreMXWl7/dqpEkwsIk= -github.com/kisielk/godepgraph v0.0.0-20190626013829-57a7e4a651a9/go.mod h1:Gb5YEgxqiSSVrXKWQxDcKoCM94NO5QAwOwTaVmIUAMI= github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.10.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= @@ -448,16 +458,9 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/ktr0731/bump v0.1.0 h1:MQdq5Vpm+2ojkm30Rmsq9RHEZufaSedpblsLBrjZl50= -github.com/ktr0731/bump v0.1.0/go.mod h1:RaAnwhvNY1dzTpF3ptJA7Z9EBW8OuVYOGXBcr7iRcgg= -github.com/ktr0731/dept v0.1.1 h1:PcktL15pzgmRguVvU75LfJirKpqveX3lqLIiq61HJSc= -github.com/ktr0731/dept v0.1.1/go.mod h1:RTx3aP/gE0/MNhYgOcxETTNBudO24Nbis4y4KImynVA= -github.com/ktr0731/go-multierror v0.0.0-20171204182908-b7773ae21874/go.mod h1:ZWayuE/hCzOD96CJizvcYnqrbmTC7RAG332yNtlKj6w= -github.com/ktr0731/go-semver v0.1.1/go.mod h1:gE6cyNMdgKcUY/d9tdlZDqiLYPixpJcZh3addTcQSp4= -github.com/ktr0731/modfile v1.11.2/go.mod h1:LzNwnHJWHbuDh3BO17lIqzqDldXqGu1HCydWH3SinE0= -github.com/kulti/thelper v0.1.0/go.mod h1:vMu2Cizjy/grP+jmsvOFDx1kYP6+PD1lqg4Yu5exl2U= -github.com/kulti/thelper v0.2.0/go.mod h1:vMu2Cizjy/grP+jmsvOFDx1kYP6+PD1lqg4Yu5exl2U= +github.com/kulti/thelper v0.2.1 h1:H4rSHiB3ALx//SXr+k9OPqKoOw2cAZpIQwVNH1RL5T4= github.com/kulti/thelper v0.2.1/go.mod h1:vMu2Cizjy/grP+jmsvOFDx1kYP6+PD1lqg4Yu5exl2U= github.com/kunwardeep/paralleltest v1.0.2 h1:/jJRv0TiqPoEy/Y8dQxCFJhD56uS/pnvtatgTZBHokU= github.com/kunwardeep/paralleltest v1.0.2/go.mod h1:ZPqNm1fVHPllh5LPVujzbVz1JN2GhLxSfY+oqUsvG30= @@ -466,9 +469,6 @@ github.com/kyoh86/exportloopref v0.1.8/go.mod h1:1tUcJeiioIs7VWe5gcOObrux3lb66+s github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= -github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac= -github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= -github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.4 h1:8KGKTcQQGm0Kv7vEbKFErAoAOFyyacLStRtQSeYtvkY= github.com/magiconair/properties v1.8.4/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= @@ -476,8 +476,6 @@ github.com/maratori/testpackage v1.0.1 h1:QtJ5ZjqapShm0w5DosRjg0PRlSdAdlx+W6cCKo github.com/maratori/testpackage v1.0.1/go.mod h1:ddKdw+XG0Phzhx8BFDTKgpWP4i7MpApTE5fXSKAqwDU= github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb h1:RHba4YImhrUVQDHUCe2BNSOz4tVy2yGyXhvYDvxGgeE= github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= -github.com/matryer/moq v0.1.4 h1:dkN4G4jtl0zpssB9OPCb8D+m4zTHdnZpi62HhlGnyTU= -github.com/matryer/moq v0.1.4/go.mod h1:9RtPYjTnH1bSBIkpvtHkFN7nbWAnO7oRpdJkEIn6UtE= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= @@ -489,15 +487,13 @@ github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HN github.com/mattn/go-ieproxy v0.0.1 h1:qiyop7gCflfhwCzGyeT0gro3sF9AIg9HU98JORTkqfI= github.com/mattn/go-ieproxy v0.0.1/go.mod h1:pYabZ6IHcRpFh7vIaLfK7rdcWgFEb3SFJ6/gNWuh88E= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-runewidth v0.0.10 h1:CoZ3S2P7pvtP45xOtBw+/mDL2z0RKI576gSkzRRpdGg= github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/mattn/go-shellwords v1.0.10 h1:Y7Xqm8piKOO3v10Thp7Z36h4FYFjt5xB//6XvOrs2Gw= github.com/mattn/go-shellwords v1.0.10/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y= @@ -507,8 +503,6 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5 github.com/mbilski/exhaustivestruct v1.1.0 h1:4ykwscnAFeHJruT+EY3M3vdeP8uXMh0VV2E61iR7XD8= github.com/mbilski/exhaustivestruct v1.1.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= -github.com/micmonay/keybd_event v1.1.0 h1:fQzkqiG/Siwji1Ju9NDkIb8FSFFlPU76YbJntrXdtQw= -github.com/micmonay/keybd_event v1.1.0/go.mod h1:QS2Kfz0PbPezFqMPEot+l/cK78/tHLZtZ7AbYUCRKsQ= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/copystructure v1.0.0 h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ= @@ -521,7 +515,6 @@ github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eI github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8= github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= @@ -538,26 +531,30 @@ github.com/nakabonne/nestif v0.3.0 h1:+yOViDGhg8ygGrmII72nV9B/zGxY188TYpfolntsaP github.com/nakabonne/nestif v0.3.0/go.mod h1:dI314BppzXjJ4HsCnbo7XzrJHPszZsjnk5wEBSYHI2c= github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d h1:AREM5mwr4u1ORQBMvzfzBgpsctsbQikCVpvC+tX285E= github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nishanths/exhaustive v0.1.0 h1:kVlMw8h2LHPMGUVqUj6230oQjjTMFjwcZrnkhXzFfl8= github.com/nishanths/exhaustive v0.1.0/go.mod h1:S1j9110vxV1ECdCudXRkeMnFQ/DQk9ajLT0Uf2MYZQQ= +github.com/nishanths/predeclared v0.2.1 h1:1TXtjmy4f3YCFjTxRd8zcFHOmoUir+gp0ESzjFzG2sw= github.com/nishanths/predeclared v0.2.1/go.mod h1:HvkGJcA3naj4lOwnFXFDkFxVtSqQMB9sbB1usJ+xjQE= github.com/nsf/termbox-go v0.0.0-20201124104050-ed494de23a00 h1:Rl8NelBe+n7SuLbJyw13ho7CGWUt2BjGGKIoreCWQ/c= github.com/nsf/termbox-go v0.0.0-20201124104050-ed494de23a00/go.mod h1:T0cTdVuOwf7pHQNtfhnEbzHbcNyCEcVU4YPpouCbVxo= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.1 h1:jMU0WaQrP0a/YAEq8eJmJKjBoMs+pClEr1vDMlM/Do4= github.com/onsi/ginkgo v1.14.1/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.10.2 h1:aY/nuoWlKJud2J6U0E3NWsjlg+0GtwXxgEqthRdzlcs= github.com/onsi/gomega v1.10.2/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 h1:lDH9UUVJtmYCjyT0CI4q8xvlXPxeZ0gYCVvWbmPlp88= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= -github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.8.1 h1:1Nf83orprkJyknT6h7zbuEGUEjcyVlCxSUGTENmNCRM= github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc= @@ -570,8 +567,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/polyfloyd/go-errorlint v0.0.0-20201006195004-351e25ade6e3 h1:Amgs0nbayPhBNGh1qPqqr2e7B2qNAcBgRjnBH/lmn8k= github.com/polyfloyd/go-errorlint v0.0.0-20201006195004-351e25ade6e3/go.mod h1:wi9BfjxjF/bwiZ701TzmfKu6UKC357IOAtNr0Td0Lvw= +github.com/polyfloyd/go-errorlint v0.0.0-20201127212506-19bd8db6546f h1:xAw10KgJqG5NJDfmRqJ05Z0IFblKumjtMeyiOLxj3+4= github.com/polyfloyd/go-errorlint v0.0.0-20201127212506-19bd8db6546f/go.mod h1:wi9BfjxjF/bwiZ701TzmfKu6UKC357IOAtNr0Td0Lvw= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -585,11 +582,12 @@ github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/quasilyte/go-consistent v0.0.0-20190521200055-c6f3937de18c/go.mod h1:5STLWrekHfjyYwxBRVRXNOSewLJ3PWfDJd1VyTS21fI= -github.com/quasilyte/go-ruleguard v0.2.0 h1:UOVMyH2EKkxIfzrULvA9n/tO+HtEhqD9mrLSWMr5FwU= github.com/quasilyte/go-ruleguard v0.2.0/go.mod h1:2RT/tf0Ce0UDj5y243iWKosQogJd8+1G3Rs2fxmlYnw= +github.com/quasilyte/go-ruleguard v0.2.1-0.20201030093329-408e96760278 h1:5gcJ7tORNCNB2QjOJF+MYjzS9aiWpxhP3gntf7RVrOQ= github.com/quasilyte/go-ruleguard v0.2.1-0.20201030093329-408e96760278/go.mod h1:2RT/tf0Ce0UDj5y243iWKosQogJd8+1G3Rs2fxmlYnw= github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 h1:L8QM9bvf68pVdQ3bCFZMDmnt9yqcMBro1pC7F+IPYMY= github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= +github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.1.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= @@ -598,8 +596,8 @@ github.com/rogpeppe/go-internal v1.5.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTE github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.6.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryancurrah/gomodguard v1.1.0 h1:DWbye9KyMgytn8uYpuHkwf0RHqAYO6Ay/D0TbCpPtVU= github.com/ryancurrah/gomodguard v1.1.0/go.mod h1:4O8tr7hBODaGE6VIhfJDHcwzh5GUccKSJBU0UMXJFVM= +github.com/ryancurrah/gomodguard v1.2.0 h1:YWfhGOrXwLGiqcC/u5EqG6YeS8nh+1fw0HEc85CVZro= github.com/ryancurrah/gomodguard v1.2.0/go.mod h1:rNqbC4TOIdUDcVMSIpNNAzTbzXAZa6W5lnUepvuMMgQ= github.com/ryanrolds/sqlclosecheck v0.3.0 h1:AZx+Bixh8zdUBxUA1NxbxVAS78vTPq4rCb8OUZI9xFw= github.com/ryanrolds/sqlclosecheck v0.3.0/go.mod h1:1gREqxyTGR3lVtpngyFo3hZAgk0KCtEdgEkHwDbigdA= @@ -625,8 +623,10 @@ github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrf github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/assertions v1.0.0 h1:UVQPSSmc3qtTi+zPPkCXvZX9VvW/xT/NsRvKfwY81a8= github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h1:SnhjPscd9TpLiy1LpzGSKh3bXCfxxXuqd9xmQJy3slM= +github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/smartystreets/gunit v1.0.0/go.mod h1:qwPWnhz6pn0NnRBP++URONOVyNkPyr4SauJk4cUOwJs= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= @@ -635,17 +635,14 @@ github.com/sonatard/noctx v0.0.1/go.mod h1:9D2D/EoULe8Yy2joDHJj7bv3sZoq9AaSb8B4l github.com/sourcegraph/go-diff v0.6.1 h1:hmA1LzxW0n1c3Q4YbrFgg4P99GSnebYa3x8gr0HZqLQ= github.com/sourcegraph/go-diff v0.6.1/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.4.1 h1:asw9sl74539yqavKaglDM5hFpdJVK0Y5Dr/JOgQ89nQ= github.com/spf13/afero v1.4.1/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= -github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v1.1.1 h1:KfztREH0tPxJJ+geloSLaAkaPkr4ki2Er5quFV1TDo4= github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= -github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= @@ -658,7 +655,6 @@ github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5q github.com/ssgreg/nlreturn/v2 v2.1.0 h1:6/s4Rc49L6Uo6RLjhWZGBpWWjfzk2yrf1nIW8m4wgVA= github.com/ssgreg/nlreturn/v2 v2.1.0/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= @@ -672,12 +668,13 @@ github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2 h1:Xr9gkxfOP0KQWXKNqmwe8vEeSUiUj4Rlee9CMVX2ZUQ= github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM= -github.com/tetafro/godot v1.3.0 h1:rKXb6aAz2AnwS98jYlU3snCFFXnIInQdaGiftNwpj+k= github.com/tetafro/godot v1.3.0/go.mod h1:/7NLHhv08H1+8DNj0MElpAACw1ajsCuf3TKNQxA5S+0= +github.com/tetafro/godot v1.3.2 h1:HzWC3XjadkyeuBZxkfAFNY20UVvle0YD51I6zf6RKlU= github.com/tetafro/godot v1.3.2/go.mod h1:ah7jjYmOMnIjS9ku2krapvGQrFNtTLo9Z/qB3dGU1eU= github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e h1:RumXZ56IrCj4CL+g1b9OL/oH0QnsF976bC8xQFYUD5Q= github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= github.com/tj/assert v0.0.0-20171129193455-018094318fb0/go.mod h1:mZ9/Rh9oLWpLLDRpvE+3b7gP/C2YyLFYxNmcLnPTMe0= +github.com/tj/assert v0.0.3 h1:Df/BlaZ20mq6kuai7f5z2TvPFiwC3xaWJSDQNiIS3Rk= github.com/tj/assert v0.0.3/go.mod h1:Ne6X72Q+TB1AteidzQncjw9PabbMp4PBMZ1k+vd1Pvk= github.com/tj/go-buffer v1.1.0/go.mod h1:iyiJpfFcR2B9sXu7KvjbT9fpM4mOelRSDTbntVj52Uc= github.com/tj/go-elastic v0.0.0-20171221160941-36157cbbebc2/go.mod h1:WjeM0Oo1eNAjXGDx2yma7uG2XoyRZTq1uv3M/o7imD0= @@ -686,8 +683,8 @@ github.com/tj/go-spin v1.1.0/go.mod h1:Mg1mzmePZm4dva8Qz60H2lHwmJ2loum4VIrLgVnKw github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tomarrell/wrapcheck v0.0.0-20200807122107-df9e8bcb914d h1:3EZyvNUMsGD1QA8cu0STNn1L7I77rvhf2IhOcHYQhSw= github.com/tomarrell/wrapcheck v0.0.0-20200807122107-df9e8bcb914d/go.mod h1:yiFB6fFoV7saXirUGfuK+cPtUh4NX/Hf5y2WC2lehu0= -github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa h1:RC4maTWLKKwb7p1cnoygsbKIgNlJqSYBeAFON3Ar8As= github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa/go.mod h1:dSUh0FtTP8VhvkL1S+gUR1OKd9ZnSaozuI6r3m6wOig= +github.com/tommy-muehle/go-mnd v1.3.1-0.20201008215730-16041ac3fe65 h1:Y0bLA422kvb32uZI4fy/Plop/Tbld0l9pSzl+j1FWok= github.com/tommy-muehle/go-mnd v1.3.1-0.20201008215730-16041ac3fe65/go.mod h1:T22e7iRN4LsFPZGyRLRXeF+DWVXFuV9thsyO7NjbbTI= github.com/ulikunitz/xz v0.5.7/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ulikunitz/xz v0.5.8 h1:ERv8V6GKqVi23rgu5cj9pVfVzJbOqAY2Ntl88O6c2nQ= @@ -707,6 +704,7 @@ github.com/xanzy/go-gitlab v0.39.0/go.mod h1:sPLojNBn68fMUWSxIJtdVVIP8uSBYqesTfD github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4= github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI= github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= +github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo= github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -721,7 +719,6 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3 h1:8sGtKOrtQqkN1bp2AtX+misvLIlOmsEsNd+9NIcPEm8= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/goleak v0.10.0/go.mod h1:VCZuO8V8mFPlL0F5J5GK1rtHV3DrFcQ1R8ryq7FK0aI= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= gocloud.dev v0.20.0 h1:mbEKMfnyPV7W1Rj35R1xXfjszs9dXkwSOq2KoFr25g8= @@ -761,6 +758,7 @@ golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= @@ -769,8 +767,8 @@ golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.0 h1:8pl+sMODzuvGJkmj2W4kZihvVb5mKm8pB/X44PIQHv8= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -825,8 +823,8 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -835,7 +833,6 @@ golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116161606-93218def8b18/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -846,8 +843,6 @@ golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756 h1:9nuHUbU8dRnRRfj9KjWUVrJeoexdbeMjttk6Oh1rD10= -golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -874,18 +869,14 @@ golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201009025420-dfb3f7c4e634 h1:bNEHhJCnrwMKNMmOx3yAynp5vs5/gRy+XWFtZFu7NBM= golang.org/x/sys v0.0.0-20201009025420-dfb3f7c4e634/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201109165425-215b40eba54c h1:+B+zPA6081G5cEb2triOIJpcvSW4AYzmIyWAqMn2JAc= golang.org/x/sys v0.0.0-20201109165425-215b40eba54c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4 h1:0YWbFKbhXG/wIiuHDSKpS0Iy7FSA+u45VtBMfQcFTTc= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -961,25 +952,22 @@ golang.org/x/tools v0.0.0-20200625211823-6506e20df31f/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200731060945-b5fad4ed8dd6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200812195022-5ae4c3c160a0/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200815165600-90abf76919f3/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200820010801-b793a1359eac/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200831203904-5a2aa26beb65/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201001104356-43ebab892c4c/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= golang.org/x/tools v0.0.0-20201002184944-ecd9fd270d5d/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= golang.org/x/tools v0.0.0-20201007032633-0806396f153e/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= golang.org/x/tools v0.0.0-20201011145850-ed2f50202694/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= -golang.org/x/tools v0.0.0-20201013201025-64a9e34f3752 h1:2ntEwh02rqo2jSsrYmp4yKHHjh0CbXP3ZtSUetSB+q8= golang.org/x/tools v0.0.0-20201013201025-64a9e34f3752/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= golang.org/x/tools v0.0.0-20201030010431-2feb2bb1ff51/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201114224030-61ea331ec02b/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201118003311-bd56c0adb394/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201121010211-780cb80bd7fb/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201230224404-63754364767c/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210101214203-2dba1e4ea05c/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210105210202-9ed45478a130 h1:8qSBr5nyKsEgkP918Pu5FFDZpTtLIjXSo6mrtdVOFfk= golang.org/x/tools v0.0.0-20210105210202-9ed45478a130/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1005,6 +993,7 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -1056,7 +1045,6 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0 h1:UhZDfRO8JRQru4/+LlLE0BRKGF8L+PICnvYZmx/fEGA= @@ -1065,14 +1053,15 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLks gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU= gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= @@ -1081,11 +1070,9 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c h1:grhR+C34yXImVGp7EzNk+DTIk+323eIUWOmEevy6bDo= gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= @@ -1098,9 +1085,8 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.6 h1:W18jzjh8mfPez+AwGLxmOImucz/IFjpNlrKVnaj2YVc= honnef.co/go/tools v0.0.1-2020.1.6/go.mod h1:pyyisuGw24ruLjrr1ddx39WE0y9OooInRzEYLhQB2YY= -mvdan.cc/gofumpt v0.0.0-20200802201014-ab5a8192947d h1:t8TAw9WgTLghti7RYkpPmqk4JtQ3+wcP5GgZqgWeWLQ= mvdan.cc/gofumpt v0.0.0-20200802201014-ab5a8192947d/go.mod h1:bzrjFmaD6+xqohD3KYP0H2FEuxknnBmyyOxdhLdaIws= -mvdan.cc/gofumpt v0.0.0-20201129102820-5c11c50e9475/go.mod h1:E4LOcu9JQEtnYXtB1Y51drqh2Qr2Ngk9J3YrRCwcbd0= +mvdan.cc/gofumpt v0.1.0 h1:hsVv+Y9UsZ/mFZTxJZuHVI6shSQCtzZ11h1JEFPAZLw= mvdan.cc/gofumpt v0.1.0/go.mod h1:yXG1r1WqZVKWbVRtBWKWX9+CxGYfA51nSomhM0woR48= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= diff --git a/helper_test.go b/helper_test.go index 9f65cb5..82563f4 100644 --- a/helper_test.go +++ b/helper_test.go @@ -1,13 +1,16 @@ package fuzzyfinder +import "time" + func New() *finder { return &finder{} } func NewWithMockedTerminal() (*finder, *TerminalMock) { f := New() - m := f.UseMockedTerminalV2() + m := f.UseMockedTerminal() w, h := 60, 10 // A normally value. m.SetSize(w, h) + m.sleepDuration = 500 * time.Microsecond return f, m } diff --git a/mock.go b/mock.go index 0c994aa..15ce304 100644 --- a/mock.go +++ b/mock.go @@ -6,7 +6,6 @@ import ( "sync" "time" - "github.com/gdamore/tcell/v2" runewidth "github.com/mattn/go-runewidth" "github.com/nsf/termbox-go" ) @@ -16,12 +15,9 @@ type cell struct { bg, fg termbox.Attribute } -type simScreen tcell.SimulationScreen - // TerminalMock is a mocked terminal for testing. // Most users should use it by calling UseMockedTerminal. type TerminalMock struct { - simScreen sizeMu sync.RWMutex width, height int @@ -35,16 +31,11 @@ type TerminalMock struct { result string sleepDuration time.Duration - v2 bool } // SetSize changes the pseudo-size of the window. // Note that SetSize resets added cells. func (m *TerminalMock) SetSize(w, h int) { - if m.v2 { - m.simScreen.SetSize(w, h) - return - } m.sizeMu.Lock() defer m.sizeMu.Unlock() m.cellsMu.Lock() @@ -54,94 +45,20 @@ func (m *TerminalMock) SetSize(w, h int) { m.cells = make([]*cell, w*h) } -// Deprecated: Use SetEventsV2 // SetEvents sets all events, which are fetched by pollEvent. // A user of this must set the EscKey event at the end. -func (m *TerminalMock) SetEvents(events ...termbox.Event) { +func (m *TerminalMock) SetEvents(e ...termbox.Event) { m.eventsMu.Lock() defer m.eventsMu.Unlock() - m.events = events -} - -// SetEventsV2 sets all events, which are fetched by pollEvent. -// A user of this must set the EscKey event at the end. -func (m *TerminalMock) SetEventsV2(events ...tcell.Event) { - for _, event := range events { - switch event := event.(type) { - case *tcell.EventKey: - ek := event - m.simScreen.InjectKey(ek.Key(), ek.Rune(), ek.Modifiers()) - case *tcell.EventResize: - er := event - w, h := er.Size() - m.simScreen.SetSize(w, h) - } - } + m.events = e } // GetResult returns a flushed string that is displayed to the actual terminal. // It contains all escape sequences such that ANSI escape code. func (m *TerminalMock) GetResult() string { - if !m.v2 { - m.resultMu.RLock() - defer m.resultMu.RUnlock() - return m.result - } - - var s string - - // set cursor for snapshot test - setCursor := func() { - cursorX, cursorY, _ := m.simScreen.GetCursor() - mainc, _, _, _ := m.simScreen.GetContent(cursorX, cursorY) - if mainc == ' ' { - m.simScreen.SetContent(cursorX, cursorY, '\u2588', nil, tcell.StyleDefault.Foreground(tcell.ColorWhite).Background(tcell.ColorDefault)) - } else { - m.simScreen.SetContent(cursorX, cursorY, mainc, nil, tcell.StyleDefault.Background(tcell.ColorWhite)) - } - m.simScreen.Show() - } - - setCursor() - - m.resultMu.Lock() - - cells, width, height := m.simScreen.GetContents() - - for h := 0; h < height; h++ { - prevFg, prevBg := tcell.ColorDefault, tcell.ColorDefault - for w := 0; w < width; w++ { - cell := cells[h*width+w] - fg, bg, attr := cell.Style.Decompose() - var fgReset bool - if fg != prevFg { - s += "\x1b\x5b\x6d" // Reset previous color. - s += parseAttrV2(&fg, nil, attr) - prevFg = fg - prevBg = tcell.ColorDefault - fgReset = true - } - if bg != prevBg { - if !fgReset { - s += "\x1b\x5b\x6d" // Reset previous color. - prevFg = tcell.ColorDefault - } - s += parseAttrV2(nil, &bg, attr) - prevBg = bg - } - s += string(cell.Runes) - rw := runewidth.RuneWidth(cell.Runes[0]) - if rw != 0 { - w += rw - 1 - } - } - s += "\n" - } - s += "\x1b\x5b\x6d" // Reset previous color. - - m.resultMu.Unlock() - - return s + m.resultMu.RLock() + defer m.resultMu.RUnlock() + return m.result } func (m *TerminalMock) init() error { @@ -208,7 +125,7 @@ func (m *TerminalMock) pollEvent() termbox.Event { } // flush displays all items with formatted layout. -func (m *TerminalMock) flush() { +func (m *TerminalMock) flush() error { m.cellsMu.RLock() var s string @@ -257,6 +174,8 @@ func (m *TerminalMock) flush() { defer m.resultMu.Unlock() m.result = s + + return nil } func (m *TerminalMock) close() {} @@ -267,31 +186,12 @@ func UseMockedTerminal() *TerminalMock { return defaultFinder.UseMockedTerminal() } -// UseMockedTerminalV2 switches the terminal, which is used from -// this package to a mocked one. -func UseMockedTerminalV2() *TerminalMock { - return defaultFinder.UseMockedTerminalV2() -} - func (f *finder) UseMockedTerminal() *TerminalMock { m := &TerminalMock{} f.term = m return m } -func (f *finder) UseMockedTerminalV2() *TerminalMock { - screen := tcell.NewSimulationScreen("UTF-8") - if err := screen.Init(); err != nil { - panic(err) - } - m := &TerminalMock{ - simScreen: screen, - v2: true, - } - f.term = m - return m -} - // parseAttr parses an attribute of termbox // as an escape sequence. // parseAttr doesn't support output modes othar than color256 in termbox-go. @@ -333,61 +233,3 @@ func parseAttr(attr termbox.Attribute, isFg bool) string { return buf.String() } - -// parseAttrV2 parses color and attribute for testing. -func parseAttrV2(fg, bg *tcell.Color, attr tcell.AttrMask) string { - if attr == tcell.AttrInvalid { - panic("invalid attribute") - } - - var buf bytes.Buffer - - buf.WriteString("\x1b[") - parseAttrMask := func() { - if attr >= tcell.AttrUnderline { - buf.WriteString("4;") - attr -= tcell.AttrUnderline - } - if attr >= tcell.AttrReverse { - buf.WriteString("7;") - attr -= tcell.AttrReverse - } - if attr >= tcell.AttrBold { - buf.WriteString("1;") - attr -= tcell.AttrBold - } - } - - if fg != nil || bg != nil { - isFg := fg != nil && bg == nil - - if isFg { - parseAttrMask() - if *fg == tcell.ColorDefault { - buf.WriteString("39") - } else { - fmt.Fprintf(&buf, "38;5;%d", toAnsi3bit(*fg)) - } - } else { - if *bg == tcell.ColorDefault { - buf.WriteString("49") - } else { - fmt.Fprintf(&buf, "48;5;%d", toAnsi3bit(*bg)) - } - } - buf.WriteString("m") - } - return buf.String() -} - -func toAnsi3bit(color tcell.Color) int { - colors := []tcell.Color{ - tcell.ColorBlack, tcell.ColorRed, tcell.ColorGreen, tcell.ColorYellow, tcell.ColorBlue, tcell.ColorDarkMagenta, tcell.ColorDarkCyan, tcell.ColorWhite, - } - for i, c := range colors { - if c == color { - return i - } - } - return 0 -} diff --git a/mock_test.go b/mock_test.go index 9978120..2332bc1 100644 --- a/mock_test.go +++ b/mock_test.go @@ -3,7 +3,6 @@ package fuzzyfinder import ( "testing" - "github.com/gdamore/tcell/v2" "github.com/google/go-cmp/cmp" "github.com/nsf/termbox-go" ) @@ -63,69 +62,3 @@ func Test_parseAttr(t *testing.T) { }) } } - -func Test_parseAttrV2(t *testing.T) { - cases := map[string]struct { - attr tcell.AttrMask - fg tcell.Color - bg tcell.Color - isBg bool - expected string - willPanic bool - }{ - "ColorDefault": { - fg: tcell.ColorDefault, - expected: "\x1b[39m", - }, - "ColorDefault bg": { - bg: tcell.ColorDefault, - isBg: true, - expected: "\x1b[49m", - }, - "ColorGreen": { - fg: tcell.ColorGreen, - expected: "\x1b[38;5;2m", - }, - "ColorGreen with bold": { - attr: tcell.AttrBold, - fg: tcell.ColorGreen, - expected: "\x1b[1;38;5;2m", - }, - "ColorGreen with bold and underline": { - attr: tcell.AttrBold | tcell.AttrUnderline, - fg: tcell.ColorGreen, - expected: "\x1b[4;1;38;5;2m", - }, - "ColorGreen with reverse": { - attr: tcell.AttrReverse, - fg: tcell.ColorGreen, - expected: "\x1b[7;38;5;2m", - }, - "invalid color": { - attr: tcell.AttrInvalid, - willPanic: true, - }, - } - - for name, c := range cases { - c := c - t.Run(name, func(t *testing.T) { - if c.willPanic { - defer func() { - if err := recover(); err == nil { - t.Errorf("must panic") - } - }() - } - var actual string - if c.isBg { - actual = parseAttrV2(nil, &c.bg, c.attr) - } else { - actual = parseAttrV2(&c.fg, nil, c.attr) - } - if diff := cmp.Diff(c.expected, actual); diff != "" { - t.Errorf("diff found: \n%s\nexpected = %x, actual = %x", diff, c.expected, actual) - } - }) - } -} diff --git a/tcell.go b/tcell.go index 7c431c6..5c08221 100644 --- a/tcell.go +++ b/tcell.go @@ -1,15 +1,52 @@ package fuzzyfinder import ( - "github.com/gdamore/tcell/v2" + "github.com/nsf/termbox-go" ) -type screen tcell.Screen - +// terminal is an abstraction for mocking termbox-go. type terminal interface { - screen + init() error + size() (width int, height int) + clear(termbox.Attribute, termbox.Attribute) error + setCell(x, y int, ch rune, fg, bg termbox.Attribute) + setCursor(x, y int) + pollEvent() termbox.Event + flush() error + close() +} + +// termImpl is the implementation for termbox-go. +type termImpl struct{} + +func (t *termImpl) init() error { + return termbox.Init() +} + +func (t *termImpl) size() (width int, height int) { + return termbox.Size() +} + +func (t *termImpl) clear(fg termbox.Attribute, bg termbox.Attribute) error { + return termbox.Clear(fg, bg) +} + +func (t *termImpl) setCell(x int, y int, ch rune, fg termbox.Attribute, bg termbox.Attribute) { + termbox.SetCell(x, y, ch, fg, bg) +} + +func (t *termImpl) setCursor(x int, y int) { + termbox.SetCursor(x, y) +} + +func (t *termImpl) pollEvent() termbox.Event { + return termbox.PollEvent() +} + +func (t *termImpl) flush() error { + return termbox.Flush() } -type termImpl struct { - screen +func (t *termImpl) close() { + termbox.Close() } diff --git a/testdata/fixtures/testfind-arrow_left-right.golden b/testdata/fixtures/testfind-arrow_left-right.golden index e67a53d..331a64f 100644 --- a/testdata/fixtures/testfind-arrow_left-right.golden +++ b/testdata/fixtures/testfind-arrow_left-right.golden @@ -6,6 +6,6 @@ │ │ │ │ │ │ - 0/9 │ │ -> ゆるふわ樹海 └────────────────────────────┘ + 0/9 │ │ +> ゆるふわ樹海ガール └────────────────────────────┘  \ No newline at end of file diff --git a/testdata/fixtures/testfind-arrow_left_backspace.golden b/testdata/fixtures/testfind-arrow_left_backspace.golden deleted file mode 100644 index de9617e..0000000 --- a/testdata/fixtures/testfind-arrow_left_backspace.golden +++ /dev/null @@ -1,11 +0,0 @@ - ┌────────────────────────────┐ - │ not found │ - │ │ - │ │ - │ │ - │ │ - │ │ - │ │ - 0/9 │ │ -> オレジ └────────────────────────────┘ - \ No newline at end of file diff --git a/testdata/fixtures/testfind-arrow_up-down.golden b/testdata/fixtures/testfind-arrow_up-down.golden index 0c9b9a6..965ef8b 100644 --- a/testdata/fixtures/testfind-arrow_up-down.golden +++ b/testdata/fixtures/testfind-arrow_up-down.golden @@ -4,8 +4,8 @@ closing │ │ ソラニン │ │ adrenaline!!! │ │ -> ヒトリノ夜 │ │ +> ヒトリノ夜 │ │ あの日自分が出て行ってや.. │ │ - 9/9 │ │ -> █ └────────────────────────────┘ + 9/9 │ │ +> █ └────────────────────────────┘  \ No newline at end of file diff --git a/testdata/fixtures/testfind-backspace.golden b/testdata/fixtures/testfind-backspace.golden index 2fad9ba..6962f71 100644 --- a/testdata/fixtures/testfind-backspace.golden +++ b/testdata/fixtures/testfind-backspace.golden @@ -6,6 +6,6 @@ │ │ │ │ │ │ - 0/9 │ │ -> adr █ └────────────────────────────┘ + 0/9 │ │ +> adrenaline!!! -TV er └────────────────────────────┘  \ No newline at end of file diff --git a/testdata/fixtures/testfind-backspace2.golden b/testdata/fixtures/testfind-backspace2.golden index 8ed188b..1adfcbc 100644 --- a/testdata/fixtures/testfind-backspace2.golden +++ b/testdata/fixtures/testfind-backspace2.golden @@ -6,6 +6,6 @@ │ │ │ │ │ │ - 0/9 │ │ -> オレ█ └────────────────────────────┘ + 0/9 │ │ +> オレ█ └────────────────────────────┘  \ No newline at end of file diff --git a/testdata/fixtures/testfind-backspace_doesnt_change_x_if_cursorx_is_0.golden b/testdata/fixtures/testfind-backspace_doesnt_change_x_if_cursorx_is_0.golden index a3a49af..ac08c85 100644 --- a/testdata/fixtures/testfind-backspace_doesnt_change_x_if_cursorx_is_0.golden +++ b/testdata/fixtures/testfind-backspace_doesnt_change_x_if_cursorx_is_0.golden @@ -5,7 +5,7 @@ │ │ │ │ Catch the Moment │ │ -> adrenaline!!! │ │ - 2/9 │ │ -> a█ └────────────────────────────┘ +> adrenaline!!! │ │ + 2/9 │ │ +> a█ └────────────────────────────┘  \ No newline at end of file diff --git a/testdata/fixtures/testfind-backspace_empty.golden b/testdata/fixtures/testfind-backspace_empty.golden index f386d2d..3548920 100644 --- a/testdata/fixtures/testfind-backspace_empty.golden +++ b/testdata/fixtures/testfind-backspace_empty.golden @@ -5,7 +5,7 @@ ソラニン │ │ adrenaline!!! │ │ ヒトリノ夜 │ │ -> あの日自分が出て行ってや.. │ │ - 9/9 │ │ -> █ └────────────────────────────┘ +> あの日自分が出て行ってや.. │ │ + 9/9 │ │ +> █ └────────────────────────────┘  \ No newline at end of file diff --git a/testdata/fixtures/testfind-ctrl-e.golden b/testdata/fixtures/testfind-ctrl-e.golden index 32d933b..f07e550 100644 --- a/testdata/fixtures/testfind-ctrl-e.golden +++ b/testdata/fixtures/testfind-ctrl-e.golden @@ -6,6 +6,6 @@ │ │ │ │ │ │ - 0/9 │ │ -> 恋をしたのは█ └────────────────────────────┘ + 0/9 │ │ +> 恋をしたのは█ └────────────────────────────┘  \ No newline at end of file diff --git a/testdata/fixtures/testfind-ctrl-u.golden b/testdata/fixtures/testfind-ctrl-u.golden index 4187243..4b90bab 100644 --- a/testdata/fixtures/testfind-ctrl-u.golden +++ b/testdata/fixtures/testfind-ctrl-u.golden @@ -6,6 +6,6 @@ │ │ │ │ │ │ - 0/9 │ │ -> は█ └────────────────────────────┘ + 0/9 │ │ +> は█ └────────────────────────────┘  \ No newline at end of file diff --git a/testdata/fixtures/testfind-ctrl-w.golden b/testdata/fixtures/testfind-ctrl-w.golden index 467692b..bbd9d93 100644 --- a/testdata/fixtures/testfind-ctrl-w.golden +++ b/testdata/fixtures/testfind-ctrl-w.golden @@ -6,6 +6,6 @@ │ │ │ │ │ │ - 0/9 │ │ -> ハロ / █ └────────────────────────────┘ + 0/9 │ │ +> ハロ / █ └────────────────────────────┘  \ No newline at end of file diff --git a/testdata/fixtures/testfind-ctrl-w_empty.golden b/testdata/fixtures/testfind-ctrl-w_emtpy.golden similarity index 67% rename from testdata/fixtures/testfind-ctrl-w_empty.golden rename to testdata/fixtures/testfind-ctrl-w_emtpy.golden index f386d2d..3548920 100644 --- a/testdata/fixtures/testfind-ctrl-w_empty.golden +++ b/testdata/fixtures/testfind-ctrl-w_emtpy.golden @@ -5,7 +5,7 @@ ソラニン │ │ adrenaline!!! │ │ ヒトリノ夜 │ │ -> あの日自分が出て行ってや.. │ │ - 9/9 │ │ -> █ └────────────────────────────┘ +> あの日自分が出て行ってや.. │ │ + 9/9 │ │ +> █ └────────────────────────────┘  \ No newline at end of file diff --git a/testdata/fixtures/testfind-delete.golden b/testdata/fixtures/testfind-delete.golden index 81c3d08..cc46143 100644 --- a/testdata/fixtures/testfind-delete.golden +++ b/testdata/fixtures/testfind-delete.golden @@ -6,6 +6,6 @@ │ │ │ │ │ │ - 0/9 │ │ -> レンジ └────────────────────────────┘ + 0/9 │ │ +> レンジ └────────────────────────────┘  \ No newline at end of file diff --git a/testdata/fixtures/testfind-delete_empty.golden b/testdata/fixtures/testfind-delete_empty.golden index f386d2d..3548920 100644 --- a/testdata/fixtures/testfind-delete_empty.golden +++ b/testdata/fixtures/testfind-delete_empty.golden @@ -5,7 +5,7 @@ ソラニン │ │ adrenaline!!! │ │ ヒトリノ夜 │ │ -> あの日自分が出て行ってや.. │ │ - 9/9 │ │ -> █ └────────────────────────────┘ +> あの日自分が出て行ってや.. │ │ + 9/9 │ │ +> █ └────────────────────────────┘  \ No newline at end of file diff --git a/testdata/fixtures/testfind-initial.golden b/testdata/fixtures/testfind-initial.golden index f386d2d..3548920 100644 --- a/testdata/fixtures/testfind-initial.golden +++ b/testdata/fixtures/testfind-initial.golden @@ -5,7 +5,7 @@ ソラニン │ │ adrenaline!!! │ │ ヒトリノ夜 │ │ -> あの日自分が出て行ってや.. │ │ - 9/9 │ │ -> █ └────────────────────────────┘ +> あの日自分が出て行ってや.. │ │ + 9/9 │ │ +> █ └────────────────────────────┘  \ No newline at end of file diff --git a/testdata/fixtures/testfind-input_glow.golden b/testdata/fixtures/testfind-input_glow.golden index 7f08c5b..643ac03 100644 --- a/testdata/fixtures/testfind-input_glow.golden +++ b/testdata/fixtures/testfind-input_glow.golden @@ -5,7 +5,7 @@ │ │ │ │ │ │ -> glow │ │ - 1/9 │ │ -> glow█ └────────────────────────────┘ +> glow │ │ + 1/9 │ │ +> glow█ └────────────────────────────┘  \ No newline at end of file diff --git a/testdata/fixtures/testfind-input_lo.golden b/testdata/fixtures/testfind-input_lo.golden index 0a5c647..4f39df8 100644 --- a/testdata/fixtures/testfind-input_lo.golden +++ b/testdata/fixtures/testfind-input_lo.golden @@ -5,7 +5,7 @@ │ │ │ │ closing │ │ -> glow │ │ - 2/9 │ │ -> lo█ └────────────────────────────┘ +> glow │ │ + 2/9 │ │ +> lo█ └────────────────────────────┘  \ No newline at end of file diff --git a/testdata/fixtures/testfind-long_item.golden b/testdata/fixtures/testfind-long_item.golden index b31ab20..b84ccdc 100644 --- a/testdata/fixtures/testfind-long_item.golden +++ b/testdata/fixtures/testfind-long_item.golden @@ -2,10 +2,10 @@ メーベル │ Name: ソラニン │ glow │ Artist: ASIAN KUNG-FU GEN..│ closing │ │ -> ソラニン │ │ +> ソラニン │ │ adrenaline!!! │ │ ヒトリノ夜 │ │ あの日自分が出て行ってや.. │ │ - 9/9 │ │ -> █ └────────────────────────────┘ + 9/9 │ │ +> █ └────────────────────────────┘  \ No newline at end of file diff --git a/testdata/fixtures/testfind-paging.golden b/testdata/fixtures/testfind-paging.golden index a2ae44c..3807efd 100644 --- a/testdata/fixtures/testfind-paging.golden +++ b/testdata/fixtures/testfind-paging.golden @@ -1,4 +1,4 @@ -> Catch the Moment ┌────────────────────────────┐ +> Catch the Moment ┌────────────────────────────┐ ICHIDAIJI │ Name: Catch the Moment │ メーベル │ Artist: LiSA │ glow │ │ @@ -6,6 +6,6 @@ ソラニン │ │ adrenaline!!! │ │ ヒトリノ夜 │ │ - 9/9 │ │ -> █ └────────────────────────────┘ + 9/9 │ │ +> █ └────────────────────────────┘  \ No newline at end of file diff --git a/testdata/fixtures/testfind-tab_doesnt_work.golden b/testdata/fixtures/testfind-tab_doesnt_work.golden index f386d2d..3548920 100644 --- a/testdata/fixtures/testfind-tab_doesnt_work.golden +++ b/testdata/fixtures/testfind-tab_doesnt_work.golden @@ -5,7 +5,7 @@ ソラニン │ │ adrenaline!!! │ │ ヒトリノ夜 │ │ -> あの日自分が出て行ってや.. │ │ - 9/9 │ │ -> █ └────────────────────────────┘ +> あの日自分が出て行ってや.. │ │ + 9/9 │ │ +> █ └────────────────────────────┘  \ No newline at end of file diff --git a/testdata/fixtures/testfind_hotreload.golden b/testdata/fixtures/testfind_hotreload.golden index 4a567d3..e727483 100644 --- a/testdata/fixtures/testfind_hotreload.golden +++ b/testdata/fixtures/testfind_hotreload.golden @@ -5,7 +5,7 @@ │ │ │ │ │ │ -> adrenaline!!! │ │ - 1/9 │ │ -> adrena█ └────────────────────────────┘ +> adrenaline!!! │ │ + 1/9 │ │ +> adrena█ └────────────────────────────┘  \ No newline at end of file