all: use fmt.Errorf for fomartting errors

Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
This commit is contained in:
Wagner Riffel 2019-09-03 16:34:04 -03:00 committed by Drew DeVault
parent 6838c23478
commit feacca3c5c
10 changed files with 10 additions and 15 deletions

View File

@ -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)
}

View File

@ -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)
}

View File

@ -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)
}

View File

@ -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)
}

View File

@ -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()

View File

@ -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)
}

View File

@ -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)
}

View File

@ -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)
}

View File

@ -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]

View File

@ -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 '<'")