diff options
author | Wagner Riffel <wgrriffel@gmail.com> | 2019-09-03 16:34:04 -0300 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-09-04 16:30:57 -1000 |
commit | feacca3c5caffb11be1f5f7cbfef01400b5bc944 (patch) | |
tree | 7f54b1affcfc2d905613de9e00b95ab4cba45a77 | |
parent | 6838c23478944a9b45df1fa9a0f432ec77423987 (diff) |
all: use fmt.Errorf for fomartting errors
Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
-rw-r--r-- | commands/account/next-folder.go | 2 | ||||
-rw-r--r-- | commands/account/next-result.go | 2 | ||||
-rw-r--r-- | commands/account/next.go | 2 | ||||
-rw-r--r-- | commands/compose/next-field.go | 3 | ||||
-rw-r--r-- | commands/ct.go | 2 | ||||
-rw-r--r-- | commands/msgview/next-part.go | 3 | ||||
-rw-r--r-- | commands/msgview/toggle-headers.go | 3 | ||||
-rw-r--r-- | commands/next-tab.go | 3 | ||||
-rw-r--r-- | commands/prompt.go | 3 | ||||
-rw-r--r-- | config/bindings.go | 2 |
10 files changed, 10 insertions, 15 deletions
diff --git a/commands/account/next-folder.go b/commands/account/next-folder.go index 6a22772..037cd31 100644 --- a/commands/account/next-folder.go +++ b/commands/account/next-folder.go @@ -49,5 +49,5 @@ func (NextPrevFolder) Execute(aerc *widgets.Aerc, args []string) error { } func nextPrevFolderUsage(cmd string) error { - return errors.New(fmt.Sprintf("Usage: %s [n]", cmd)) + return fmt.Errorf("Usage: %s [n]", cmd) } diff --git a/commands/account/next-result.go b/commands/account/next-result.go index ab050af..78d437d 100644 --- a/commands/account/next-result.go +++ b/commands/account/next-result.go @@ -46,5 +46,5 @@ func (NextPrevResult) Execute(aerc *widgets.Aerc, args []string) error { } func nextPrevResultUsage(cmd string) error { - return errors.New(fmt.Sprintf("Usage: %s [<n>[%%]]", cmd)) + return fmt.Errorf("Usage: %s [<n>[%%]]", cmd) } diff --git a/commands/account/next.go b/commands/account/next.go index 604dcd7..e1d3eeb 100644 --- a/commands/account/next.go +++ b/commands/account/next.go @@ -78,5 +78,5 @@ func ExecuteNextPrevMessage(args []string, acct *widgets.AccountView, pct bool, } func nextPrevMessageUsage(cmd string) error { - return errors.New(fmt.Sprintf("Usage: %s [<n>[%%]]", cmd)) + return fmt.Errorf("Usage: %s [<n>[%%]]", cmd) } diff --git a/commands/compose/next-field.go b/commands/compose/next-field.go index 43ae644..a81852e 100644 --- a/commands/compose/next-field.go +++ b/commands/compose/next-field.go @@ -1,7 +1,6 @@ package compose import ( - "errors" "fmt" "git.sr.ht/~sircmpwn/aerc/widgets" @@ -35,5 +34,5 @@ func (NextPrevField) Execute(aerc *widgets.Aerc, args []string) error { } func nextPrevFieldUsage(cmd string) error { - return errors.New(fmt.Sprintf("Usage: %s", cmd)) + return fmt.Errorf("Usage: %s", cmd) } diff --git a/commands/ct.go b/commands/ct.go index f84e8a9..3cae0bd 100644 --- a/commands/ct.go +++ b/commands/ct.go @@ -34,7 +34,7 @@ func (ChangeTab) Complete(aerc *widgets.Aerc, args []string) []string { func (ChangeTab) Execute(aerc *widgets.Aerc, args []string) error { if len(args) != 2 { - return errors.New(fmt.Sprintf("Usage: %s <tab>", args[0])) + return fmt.Errorf("Usage: %s <tab>", args[0]) } if args[1] == "-" { ok := aerc.SelectPreviousTab() diff --git a/commands/msgview/next-part.go b/commands/msgview/next-part.go index c9423cc..a98e96a 100644 --- a/commands/msgview/next-part.go +++ b/commands/msgview/next-part.go @@ -1,7 +1,6 @@ package msgview import ( - "errors" "fmt" "strconv" @@ -48,5 +47,5 @@ func (NextPrevPart) Execute(aerc *widgets.Aerc, args []string) error { } func nextPrevPartUsage(cmd string) error { - return errors.New(fmt.Sprintf("Usage: %s [n]", cmd)) + return fmt.Errorf("Usage: %s [n]", cmd) } diff --git a/commands/msgview/toggle-headers.go b/commands/msgview/toggle-headers.go index f13e27d..e777d9b 100644 --- a/commands/msgview/toggle-headers.go +++ b/commands/msgview/toggle-headers.go @@ -1,7 +1,6 @@ package msgview import ( - "errors" "fmt" "git.sr.ht/~sircmpwn/aerc/widgets" @@ -31,5 +30,5 @@ func (ToggleHeaders) Execute(aerc *widgets.Aerc, args []string) error { } func toggleHeadersUsage(cmd string) error { - return errors.New(fmt.Sprintf("Usage: %s", cmd)) + return fmt.Errorf("Usage: %s", cmd) } diff --git a/commands/next-tab.go b/commands/next-tab.go index 5af8692..fc668f1 100644 --- a/commands/next-tab.go +++ b/commands/next-tab.go @@ -1,7 +1,6 @@ package commands import ( - "errors" "fmt" "strconv" @@ -47,5 +46,5 @@ func (NextPrevTab) Execute(aerc *widgets.Aerc, args []string) error { } func nextPrevTabUsage(cmd string) error { - return errors.New(fmt.Sprintf("Usage: %s [n]", cmd)) + return fmt.Errorf("Usage: %s [n]", cmd) } diff --git a/commands/prompt.go b/commands/prompt.go index fe152c8..2d6d01d 100644 --- a/commands/prompt.go +++ b/commands/prompt.go @@ -1,7 +1,6 @@ package commands import ( - "errors" "fmt" "git.sr.ht/~sircmpwn/aerc/widgets" @@ -23,7 +22,7 @@ func (Prompt) Complete(aerc *widgets.Aerc, args []string) []string { func (Prompt) Execute(aerc *widgets.Aerc, args []string) error { if len(args) < 3 { - return errors.New(fmt.Sprintf("Usage: %s <prompt> <cmd>", args[0])) + return fmt.Errorf("Usage: %s <prompt> <cmd>", args[0]) } prompt := args[1] diff --git a/config/bindings.go b/config/bindings.go index 46e6924..a19d4f3 100644 --- a/config/bindings.go +++ b/config/bindings.go @@ -122,7 +122,7 @@ func ParseKeyStrokes(keystrokes string) ([]KeyStroke, error) { if key, ok := keyNames[strings.ToLower(name)]; ok { strokes = append(strokes, key) } else { - return nil, errors.New(fmt.Sprintf("Unknown key '%s'", name)) + return nil, fmt.Errorf("Unknown key '%s'", name) } case '>': return nil, errors.New("Found '>' without '<'") |