From 7616f774becfb2fc1973eb4207b31d686524438f Mon Sep 17 00:00:00 2001 From: rmatsuoka <76464810+rmatsuoka@users.noreply.github.com> Date: Mon, 18 Nov 2024 21:17:46 +0900 Subject: [PATCH] fmt.Errorf to errors.New --- commands.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/commands.go b/commands.go index ba372fad1..68be727f4 100644 --- a/commands.go +++ b/commands.go @@ -3,6 +3,7 @@ package main import ( + "errors" "flag" "fmt" "os" @@ -115,11 +116,11 @@ func doConfigtest(fs *flag.FlagSet, argv []string) error { red := color.New(color.FgRed) yellow := color.New(color.FgYellow) if err != nil { - return fmt.Errorf(red.Sprintf("[CRITICAL] failed to test config: %s", err)) + return errors.New(red.Sprintf("[CRITICAL] failed to test config: %s", err)) } validResult, err := config.ValidateConfigFile(conf.Conffile) if err != nil { - return fmt.Errorf(red.Sprintf("[CRITICAL] failed to test config: %s", err)) + return errors.New(red.Sprintf("[CRITICAL] failed to test config: %s", err)) } if len(validResult) > 0 { var messages string @@ -130,7 +131,7 @@ func doConfigtest(fs *flag.FlagSet, argv []string) error { messages += yellow.Sprintf("[WARNING] %s is unexpected key. Did you mean %s ?\n", v.Key, v.SuggestKey) } } - return fmt.Errorf(messages) + return errors.New(messages) } fmt.Fprintf(os.Stderr, "SUCCESS (%s)\n", conf.Conffile)