go fmt ./...

This commit is contained in:
Yasuhiro Matsumoto 2026-02-14 17:36:53 +09:00
parent 3723b65a5f
commit c1ffd8b128
No known key found for this signature in database
GPG key ID: F2EA90DF2C146D1E
18 changed files with 65 additions and 66 deletions

View file

@ -331,7 +331,7 @@ func doFinish(ctx context.Context, state *Peco, _ Event) {
})
var err error
state.Hub().SendStatusMsg(ctx, "Executing " + ccarg)
state.Hub().SendStatusMsg(ctx, "Executing "+ccarg)
cmd := util.Shell(ccarg)
cmd.Stdin = &stdin
cmd.Stdout = state.Stdout

View file

@ -5,8 +5,8 @@ import (
"fmt"
"os"
"path/filepath"
"strings"
"strconv"
"strings"
"github.com/peco/peco/filter"
"github.com/peco/peco/internal/util"
@ -139,7 +139,7 @@ func stringsToStyle(style *Style, raw []string) error {
}
} else {
if fg, err := strconv.ParseUint(s, 10, 8); err == nil {
style.fg = Attribute(fg+1)
style.fg = Attribute(fg + 1)
}
}
@ -153,7 +153,7 @@ func stringsToStyle(style *Style, raw []string) error {
} else {
if strings.HasPrefix(s, "on_") {
if bg, err := strconv.ParseUint(s[3:], 10, 8); err == nil {
style.bg = Attribute(bg+1)
style.bg = Attribute(bg + 1)
}
}
}

View file

@ -56,7 +56,7 @@ type Regexp struct {
quotemeta bool
mutex sync.Mutex
name string
outCh pipeline.ChanOutput
outCh pipeline.ChanOutput
}
type ExternalCmd struct {

View file

@ -34,6 +34,6 @@ type Payload interface {
type payload struct {
batch bool
data interface{}
done chan struct{}
data interface{}
done chan struct{}
}

View file

@ -16,7 +16,7 @@ type KeyType uint16
// Function keys
const (
KeyF1 KeyType = 0xFFFF - iota
KeyF1 KeyType = 0xFFFF - iota
KeyF2
KeyF3
KeyF4
@ -45,8 +45,8 @@ const (
// and MouseLeft, so MouseLeft = KeyArrowRight - 2 (not -1).
const (
MouseLeft KeyType = 0xFFFF - iota - 23 // KeyArrowRight - 2
MouseMiddle // KeyArrowRight - 3
MouseRight // KeyArrowRight - 4
MouseMiddle // KeyArrowRight - 3
MouseRight // KeyArrowRight - 4
)
// Ctrl keys and special keys.

View file

@ -2,7 +2,6 @@ package keyseq
import "testing"
func TestBalance(t *testing.T) {
trie := NewTernaryTrie()

View file

@ -1,3 +1,4 @@
//go:build !darwin && !windows
// +build !darwin,!windows
package util

View file

@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package util
@ -6,13 +7,13 @@ import "os/exec"
func Shell(cmd ...string) *exec.Cmd {
const shellpath = `/bin/sh`
const shellopt = `-c`
const shellopt = `-c`
args := make([]string, len(cmd) + 1)
args := make([]string, len(cmd)+1)
args[0] = shellopt
for i := 0; i < len(cmd); i++ {
args[i+1] = cmd[i]
}
return exec.Command(shellpath, args...)
}

View file

@ -1,3 +1,4 @@
//go:build windows
// +build windows
package util
@ -6,13 +7,13 @@ import "os/exec"
func Shell(cmd ...string) *exec.Cmd {
const shellpath = `cmd`
const shellopt = `/c`
const shellopt = `/c`
args := make([]string, len(cmd) + 1)
args := make([]string, len(cmd)+1)
args[0] = shellopt
for i := 0; i < len(cmd); i++ {
args[i+1] = cmd[i]
}
return exec.Command(shellpath, args...)
}

View file

@ -1,3 +1,4 @@
//go:build darwin || freebsd || openbsd || netbsd || dragonfly
// +build darwin freebsd openbsd netbsd dragonfly
package util

View file

@ -1,3 +1,4 @@
//go:build !darwin && !windows && !freebsd && !openbsd && !netbsd && !dragonfly
// +build !darwin,!windows,!freebsd,!openbsd,!netbsd,!dragonfly
package util

View file

@ -180,4 +180,3 @@ func (km *Keymap) ApplyKeybinding() error {
return errors.Wrap(k.Compile(), "failed to compile key binding patterns")
}

View file

@ -49,5 +49,3 @@ type Matched struct {
Line
indices [][]int
}

View file

@ -9,4 +9,3 @@ func NewMatched(rl Line, matches [][]int) *Matched {
func (ml Matched) Indices() [][]int {
return ml.indices
}

View file

@ -76,4 +76,3 @@ func (rl *Raw) Output() string {
}
return rl.buf
}

View file

@ -90,28 +90,28 @@ func newPeco() *Peco {
// keyseqToTcellKey maps peco keyseq navigation/function key constants back
// to tcell key constants, for injecting events into SimulationScreen.
var keyseqToTcellKey = map[keyseq.KeyType]tcell.Key{
keyseq.KeyArrowUp: tcell.KeyUp,
keyseq.KeyArrowDown: tcell.KeyDown,
keyseq.KeyArrowLeft: tcell.KeyLeft,
keyseq.KeyArrowUp: tcell.KeyUp,
keyseq.KeyArrowDown: tcell.KeyDown,
keyseq.KeyArrowLeft: tcell.KeyLeft,
keyseq.KeyArrowRight: tcell.KeyRight,
keyseq.KeyInsert: tcell.KeyInsert,
keyseq.KeyDelete: tcell.KeyDelete,
keyseq.KeyHome: tcell.KeyHome,
keyseq.KeyEnd: tcell.KeyEnd,
keyseq.KeyPgup: tcell.KeyPgUp,
keyseq.KeyPgdn: tcell.KeyPgDn,
keyseq.KeyF1: tcell.KeyF1,
keyseq.KeyF2: tcell.KeyF2,
keyseq.KeyF3: tcell.KeyF3,
keyseq.KeyF4: tcell.KeyF4,
keyseq.KeyF5: tcell.KeyF5,
keyseq.KeyF6: tcell.KeyF6,
keyseq.KeyF7: tcell.KeyF7,
keyseq.KeyF8: tcell.KeyF8,
keyseq.KeyF9: tcell.KeyF9,
keyseq.KeyF10: tcell.KeyF10,
keyseq.KeyF11: tcell.KeyF11,
keyseq.KeyF12: tcell.KeyF12,
keyseq.KeyInsert: tcell.KeyInsert,
keyseq.KeyDelete: tcell.KeyDelete,
keyseq.KeyHome: tcell.KeyHome,
keyseq.KeyEnd: tcell.KeyEnd,
keyseq.KeyPgup: tcell.KeyPgUp,
keyseq.KeyPgdn: tcell.KeyPgDn,
keyseq.KeyF1: tcell.KeyF1,
keyseq.KeyF2: tcell.KeyF2,
keyseq.KeyF3: tcell.KeyF3,
keyseq.KeyF4: tcell.KeyF4,
keyseq.KeyF5: tcell.KeyF5,
keyseq.KeyF6: tcell.KeyF6,
keyseq.KeyF7: tcell.KeyF7,
keyseq.KeyF8: tcell.KeyF8,
keyseq.KeyF9: tcell.KeyF9,
keyseq.KeyF10: tcell.KeyF10,
keyseq.KeyF11: tcell.KeyF11,
keyseq.KeyF12: tcell.KeyF12,
}
// SimScreen wraps tcell.SimulationScreen to implement peco's Screen interface.
@ -275,7 +275,6 @@ func TestPeco(t *testing.T) {
}
}
func TestPecoHelp(t *testing.T) {
p := newPeco()
p.Argv = []string{"peco", "-h"}

View file

@ -23,28 +23,28 @@ type Termbox struct {
// tcellKeyToKeyseq maps tcell navigation/function key constants to peco keyseq constants.
var tcellKeyToKeyseq = map[tcell.Key]keyseq.KeyType{
tcell.KeyUp: keyseq.KeyArrowUp,
tcell.KeyDown: keyseq.KeyArrowDown,
tcell.KeyLeft: keyseq.KeyArrowLeft,
tcell.KeyRight: keyseq.KeyArrowRight,
tcell.KeyInsert: keyseq.KeyInsert,
tcell.KeyDelete: keyseq.KeyDelete,
tcell.KeyHome: keyseq.KeyHome,
tcell.KeyEnd: keyseq.KeyEnd,
tcell.KeyPgUp: keyseq.KeyPgup,
tcell.KeyPgDn: keyseq.KeyPgdn,
tcell.KeyF1: keyseq.KeyF1,
tcell.KeyF2: keyseq.KeyF2,
tcell.KeyF3: keyseq.KeyF3,
tcell.KeyF4: keyseq.KeyF4,
tcell.KeyF5: keyseq.KeyF5,
tcell.KeyF6: keyseq.KeyF6,
tcell.KeyF7: keyseq.KeyF7,
tcell.KeyF8: keyseq.KeyF8,
tcell.KeyF9: keyseq.KeyF9,
tcell.KeyF10: keyseq.KeyF10,
tcell.KeyF11: keyseq.KeyF11,
tcell.KeyF12: keyseq.KeyF12,
tcell.KeyUp: keyseq.KeyArrowUp,
tcell.KeyDown: keyseq.KeyArrowDown,
tcell.KeyLeft: keyseq.KeyArrowLeft,
tcell.KeyRight: keyseq.KeyArrowRight,
tcell.KeyInsert: keyseq.KeyInsert,
tcell.KeyDelete: keyseq.KeyDelete,
tcell.KeyHome: keyseq.KeyHome,
tcell.KeyEnd: keyseq.KeyEnd,
tcell.KeyPgUp: keyseq.KeyPgup,
tcell.KeyPgDn: keyseq.KeyPgdn,
tcell.KeyF1: keyseq.KeyF1,
tcell.KeyF2: keyseq.KeyF2,
tcell.KeyF3: keyseq.KeyF3,
tcell.KeyF4: keyseq.KeyF4,
tcell.KeyF5: keyseq.KeyF5,
tcell.KeyF6: keyseq.KeyF6,
tcell.KeyF7: keyseq.KeyF7,
tcell.KeyF8: keyseq.KeyF8,
tcell.KeyF9: keyseq.KeyF9,
tcell.KeyF10: keyseq.KeyF10,
tcell.KeyF11: keyseq.KeyF11,
tcell.KeyF12: keyseq.KeyF12,
tcell.KeyBackspace: keyseq.KeyBackspace,
tcell.KeyTab: keyseq.KeyTab,
tcell.KeyEnter: keyseq.KeyEnter,

View file

@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package peco