From 1a8c52097971fbc1e0988ab8f807c7bdde1fc3e7 Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Fri, 28 Sep 2018 09:53:24 -0700 Subject: [PATCH] ctlv3: fix gofmt Signed-off-by: Gyuho Lee --- etcdctl/ctlv3/command/member_command.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/etcdctl/ctlv3/command/member_command.go b/etcdctl/ctlv3/command/member_command.go index 04bca6cdc..5b2119aba 100644 --- a/etcdctl/ctlv3/command/member_command.go +++ b/etcdctl/ctlv3/command/member_command.go @@ -15,6 +15,7 @@ package command import ( + "errors" "fmt" "strconv" "strings" @@ -97,21 +98,21 @@ The items in the lists are ID, Status, Name, Peer Addrs, Client Addrs. // memberAddCommandFunc executes the "member add" command. func memberAddCommandFunc(cmd *cobra.Command, args []string) { if len(args) < 1 { - ExitWithError(ExitBadArgs, fmt.Errorf("member name not provided.")) + ExitWithError(ExitBadArgs, errors.New("member name not provided")) } if len(args) > 1 { - errorstring := "too many arguments" - for _, v := range args { - if strings.HasPrefix(strings.ToLower(v), "http"){ - errorstring += ", did you mean \"--peer-urls " + v + "\"" + ev := "too many arguments" + for _, s := range args { + if strings.HasPrefix(strings.ToLower(s), "http") { + ev += fmt.Sprintf(`, did you mean --peer-urls=%s`, s) } } - ExitWithError(ExitBadArgs, fmt.Errorf(errorstring)) + ExitWithError(ExitBadArgs, errors.New(ev)) } newMemberName := args[0] if len(memberPeerURLs) == 0 { - ExitWithError(ExitBadArgs, fmt.Errorf("member peer urls not provided.")) + ExitWithError(ExitBadArgs, errors.New("member peer urls not provided")) } urls := strings.Split(memberPeerURLs, ",") @@ -198,7 +199,7 @@ func memberUpdateCommandFunc(cmd *cobra.Command, args []string) { } if len(memberPeerURLs) == 0 { - ExitWithError(ExitBadArgs, fmt.Errorf("member peer urls not provided.")) + ExitWithError(ExitBadArgs, fmt.Errorf("member peer urls not provided")) } urls := strings.Split(memberPeerURLs, ",")