Skip to content

Commit 7616f77

Browse files
committed
fmt.Errorf to errors.New
1 parent 8739d8a commit 7616f77

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

commands.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
package main
44

55
import (
6+
"errors"
67
"flag"
78
"fmt"
89
"os"
@@ -115,11 +116,11 @@ func doConfigtest(fs *flag.FlagSet, argv []string) error {
115116
red := color.New(color.FgRed)
116117
yellow := color.New(color.FgYellow)
117118
if err != nil {
118-
return fmt.Errorf(red.Sprintf("[CRITICAL] failed to test config: %s", err))
119+
return errors.New(red.Sprintf("[CRITICAL] failed to test config: %s", err))
119120
}
120121
validResult, err := config.ValidateConfigFile(conf.Conffile)
121122
if err != nil {
122-
return fmt.Errorf(red.Sprintf("[CRITICAL] failed to test config: %s", err))
123+
return errors.New(red.Sprintf("[CRITICAL] failed to test config: %s", err))
123124
}
124125
if len(validResult) > 0 {
125126
var messages string
@@ -130,7 +131,7 @@ func doConfigtest(fs *flag.FlagSet, argv []string) error {
130131
messages += yellow.Sprintf("[WARNING] %s is unexpected key. Did you mean %s ?\n", v.Key, v.SuggestKey)
131132
}
132133
}
133-
return fmt.Errorf(messages)
134+
return errors.New(messages)
134135
}
135136

136137
fmt.Fprintf(os.Stderr, "SUCCESS (%s)\n", conf.Conffile)

0 commit comments

Comments
 (0)