From 00c6090110ba053ec4f521702ff6e95ff61352eb Mon Sep 17 00:00:00 2001 From: Piotr Tabor Date: Fri, 14 May 2021 14:16:53 +0200 Subject: [PATCH] Refactor common code from etcdctl (v2,v3) to pkg/corbautl. Preparation for etcdutl split. --- etcdctl/ctlv2/command/cluster_health.go | 9 +- etcdctl/ctlv2/command/error.go | 9 - etcdctl/ctlv2/command/exec_watch_command.go | 5 +- etcdctl/ctlv2/command/get_command.go | 5 +- etcdctl/ctlv2/command/ls_command.go | 3 +- etcdctl/ctlv2/command/mk_command.go | 7 +- etcdctl/ctlv2/command/mkdir_command.go | 5 +- etcdctl/ctlv2/command/rm_command.go | 5 +- etcdctl/ctlv2/command/rmdir_command.go | 5 +- etcdctl/ctlv2/command/set_command.go | 7 +- etcdctl/ctlv2/command/update_command.go | 7 +- etcdctl/ctlv2/command/update_dir_command.go | 5 +- etcdctl/ctlv2/command/util.go | 5 +- etcdctl/ctlv2/command/watch_command.go | 5 +- etcdctl/ctlv3/command/alarm_command.go | 9 +- etcdctl/ctlv3/command/auth_command.go | 13 +- etcdctl/ctlv3/command/check.go | 27 +- etcdctl/ctlv3/command/compaction_command.go | 7 +- etcdctl/ctlv3/command/defrag_command.go | 5 +- etcdctl/ctlv3/command/del_command.go | 9 +- etcdctl/ctlv3/command/elect_command.go | 9 +- etcdctl/ctlv3/command/ep_command.go | 21 +- etcdctl/ctlv3/command/get_command.go | 21 +- etcdctl/ctlv3/command/global.go | 53 ++-- etcdctl/ctlv3/command/lease_command.go | 27 +- etcdctl/ctlv3/command/lock_command.go | 9 +- etcdctl/ctlv3/command/make_mirror_command.go | 9 +- etcdctl/ctlv3/command/member_command.go | 31 +-- etcdctl/ctlv3/command/migrate_command.go | 21 +- etcdctl/ctlv3/command/move_leader_command.go | 11 +- etcdctl/ctlv3/command/printer.go | 3 +- etcdctl/ctlv3/command/printer_protobuf.go | 3 +- etcdctl/ctlv3/command/put_command.go | 11 +- etcdctl/ctlv3/command/role_command.go | 31 +-- etcdctl/ctlv3/command/snapshot_command.go | 19 +- etcdctl/ctlv3/command/txn_command.go | 13 +- etcdctl/ctlv3/command/user_command.go | 41 +-- etcdctl/ctlv3/command/util.go | 9 +- etcdctl/ctlv3/command/watch_command.go | 17 +- etcdctl/ctlv3/ctl.go | 8 +- etcdctl/go.mod | 2 +- etcdctl/go.sum | 7 +- go.mod | 2 +- go.sum | 8 +- .../ctlv3/command => pkg/cobrautl}/error.go | 10 +- {etcdctl/ctlv3 => pkg/cobrautl}/help.go | 10 +- pkg/go.mod | 1 + pkg/go.sum | 249 +++++++++++++++++- server/go.mod | 2 +- server/go.sum | 7 +- tests/go.mod | 4 +- tests/go.sum | 8 +- 52 files changed, 553 insertions(+), 276 deletions(-) rename {etcdctl/ctlv3/command => pkg/cobrautl}/error.go (87%) rename {etcdctl/ctlv3 => pkg/cobrautl}/help.go (96%) diff --git a/etcdctl/ctlv2/command/cluster_health.go b/etcdctl/ctlv2/command/cluster_health.go index aa311961fb2..a89646b9f54 100644 --- a/etcdctl/ctlv2/command/cluster_health.go +++ b/etcdctl/ctlv2/command/cluster_health.go @@ -25,6 +25,7 @@ import ( "time" "go.etcd.io/etcd/client/v2" + "go.etcd.io/etcd/pkg/v3/cobrautl" "github.com/urfave/cli" ) @@ -55,7 +56,7 @@ func handleClusterHealth(c *cli.Context) error { tr, err := getTransport(c) if err != nil { - handleError(c, ExitServerError, err) + handleError(c, cobrautl.ExitServerError, err) } hc := http.Client{ @@ -67,7 +68,7 @@ func handleClusterHealth(c *cli.Context) error { ms, err := mi.List(context.TODO()) if err != nil { fmt.Println("cluster may be unhealthy: failed to list members") - handleError(c, ExitServerError, err) + handleError(c, cobrautl.ExitServerError, err) } for { @@ -128,9 +129,9 @@ func handleClusterHealth(c *cli.Context) error { if !forever { if healthyMembers == len(ms) { - os.Exit(ExitSuccess) + os.Exit(cobrautl.ExitSuccess) } - os.Exit(ExitClusterNotHealthy) + os.Exit(cobrautl.ExitClusterNotHealthy) } fmt.Printf("\nnext check after 10 second...\n\n") diff --git a/etcdctl/ctlv2/command/error.go b/etcdctl/ctlv2/command/error.go index b86a97d6453..4403150af8c 100644 --- a/etcdctl/ctlv2/command/error.go +++ b/etcdctl/ctlv2/command/error.go @@ -23,15 +23,6 @@ import ( "go.etcd.io/etcd/client/v2" ) -const ( - ExitSuccess = iota - ExitBadArgs - ExitBadConnection - ExitBadAuth - ExitServerError - ExitClusterNotHealthy -) - func handleError(c *cli.Context, code int, err error) { if c.GlobalString("output") == "json" { if err, ok := err.(*client.Error); ok { diff --git a/etcdctl/ctlv2/command/exec_watch_command.go b/etcdctl/ctlv2/command/exec_watch_command.go index 58f8b529fb3..2b52d8a76c9 100644 --- a/etcdctl/ctlv2/command/exec_watch_command.go +++ b/etcdctl/ctlv2/command/exec_watch_command.go @@ -23,6 +23,7 @@ import ( "os/signal" "go.etcd.io/etcd/client/v2" + "go.etcd.io/etcd/pkg/v3/cobrautl" "github.com/urfave/cli" ) @@ -50,7 +51,7 @@ func execWatchCommandFunc(c *cli.Context, ki client.KeysAPI) { argslen := len(args) if argslen < 2 { - handleError(c, ExitBadArgs, errors.New("key and command to exec required")) + handleError(c, cobrautl.ExitBadArgs, errors.New("key and command to exec required")) } var ( @@ -93,7 +94,7 @@ func execWatchCommandFunc(c *cli.Context, ki client.KeysAPI) { for { resp, err := w.Next(context.TODO()) if err != nil { - handleError(c, ExitServerError, err) + handleError(c, cobrautl.ExitServerError, err) } if resp.Node.Dir { fmt.Fprintf(os.Stderr, "Ignored dir %s change\n", resp.Node.Key) diff --git a/etcdctl/ctlv2/command/get_command.go b/etcdctl/ctlv2/command/get_command.go index 56eaa324307..9f158c9c909 100644 --- a/etcdctl/ctlv2/command/get_command.go +++ b/etcdctl/ctlv2/command/get_command.go @@ -21,6 +21,7 @@ import ( "github.com/urfave/cli" "go.etcd.io/etcd/client/v2" + "go.etcd.io/etcd/pkg/v3/cobrautl" ) // NewGetCommand returns the CLI command for "get". @@ -43,7 +44,7 @@ func NewGetCommand() cli.Command { // getCommandFunc executes the "get" command. func getCommandFunc(c *cli.Context, ki client.KeysAPI) { if len(c.Args()) == 0 { - handleError(c, ExitBadArgs, errors.New("key required")) + handleError(c, cobrautl.ExitBadArgs, errors.New("key required")) } key := c.Args()[0] @@ -54,7 +55,7 @@ func getCommandFunc(c *cli.Context, ki client.KeysAPI) { resp, err := ki.Get(ctx, key, &client.GetOptions{Sort: sorted, Quorum: quorum}) cancel() if err != nil { - handleError(c, ExitServerError, err) + handleError(c, cobrautl.ExitServerError, err) } if resp.Node.Dir { diff --git a/etcdctl/ctlv2/command/ls_command.go b/etcdctl/ctlv2/command/ls_command.go index 363a3c49591..cbc76ba1876 100644 --- a/etcdctl/ctlv2/command/ls_command.go +++ b/etcdctl/ctlv2/command/ls_command.go @@ -19,6 +19,7 @@ import ( "github.com/urfave/cli" "go.etcd.io/etcd/client/v2" + "go.etcd.io/etcd/pkg/v3/cobrautl" ) func NewLsCommand() cli.Command { @@ -54,7 +55,7 @@ func lsCommandFunc(c *cli.Context, ki client.KeysAPI) { resp, err := ki.Get(ctx, key, &client.GetOptions{Sort: sort, Recursive: recursive, Quorum: quorum}) cancel() if err != nil { - handleError(c, ExitServerError, err) + handleError(c, cobrautl.ExitServerError, err) } printLs(c, resp) diff --git a/etcdctl/ctlv2/command/mk_command.go b/etcdctl/ctlv2/command/mk_command.go index ae9ec82ebf3..1db24f16a64 100644 --- a/etcdctl/ctlv2/command/mk_command.go +++ b/etcdctl/ctlv2/command/mk_command.go @@ -21,6 +21,7 @@ import ( "github.com/urfave/cli" "go.etcd.io/etcd/client/v2" + "go.etcd.io/etcd/pkg/v3/cobrautl" ) // NewMakeCommand returns the CLI command for "mk". @@ -43,12 +44,12 @@ func NewMakeCommand() cli.Command { // mkCommandFunc executes the "mk" command. func mkCommandFunc(c *cli.Context, ki client.KeysAPI) { if len(c.Args()) == 0 { - handleError(c, ExitBadArgs, errors.New("key required")) + handleError(c, cobrautl.ExitBadArgs, errors.New("key required")) } key := c.Args()[0] value, err := argOrStdin(c.Args(), os.Stdin, 1) if err != nil { - handleError(c, ExitBadArgs, errors.New("value required")) + handleError(c, cobrautl.ExitBadArgs, errors.New("value required")) } ttl := c.Int("ttl") @@ -69,7 +70,7 @@ func mkCommandFunc(c *cli.Context, ki client.KeysAPI) { } cancel() if err != nil { - handleError(c, ExitServerError, err) + handleError(c, cobrautl.ExitServerError, err) } printResponseKey(resp, c.GlobalString("output")) diff --git a/etcdctl/ctlv2/command/mkdir_command.go b/etcdctl/ctlv2/command/mkdir_command.go index 94174028039..1a307601e92 100644 --- a/etcdctl/ctlv2/command/mkdir_command.go +++ b/etcdctl/ctlv2/command/mkdir_command.go @@ -20,6 +20,7 @@ import ( "github.com/urfave/cli" "go.etcd.io/etcd/client/v2" + "go.etcd.io/etcd/pkg/v3/cobrautl" ) // NewMakeDirCommand returns the CLI command for "mkdir". @@ -41,7 +42,7 @@ func NewMakeDirCommand() cli.Command { // mkdirCommandFunc executes the "mkdir" command. func mkdirCommandFunc(c *cli.Context, ki client.KeysAPI, prevExist client.PrevExistType) { if len(c.Args()) == 0 { - handleError(c, ExitBadArgs, errors.New("key required")) + handleError(c, cobrautl.ExitBadArgs, errors.New("key required")) } key := c.Args()[0] @@ -51,7 +52,7 @@ func mkdirCommandFunc(c *cli.Context, ki client.KeysAPI, prevExist client.PrevEx resp, err := ki.Set(ctx, key, "", &client.SetOptions{TTL: time.Duration(ttl) * time.Second, Dir: true, PrevExist: prevExist}) cancel() if err != nil { - handleError(c, ExitServerError, err) + handleError(c, cobrautl.ExitServerError, err) } if c.GlobalString("output") != "simple" { printResponseKey(resp, c.GlobalString("output")) diff --git a/etcdctl/ctlv2/command/rm_command.go b/etcdctl/ctlv2/command/rm_command.go index 515a72a5f6e..45ccf4632fb 100644 --- a/etcdctl/ctlv2/command/rm_command.go +++ b/etcdctl/ctlv2/command/rm_command.go @@ -19,6 +19,7 @@ import ( "github.com/urfave/cli" "go.etcd.io/etcd/client/v2" + "go.etcd.io/etcd/pkg/v3/cobrautl" ) // NewRemoveCommand returns the CLI command for "rm". @@ -43,7 +44,7 @@ func NewRemoveCommand() cli.Command { // rmCommandFunc executes the "rm" command. func rmCommandFunc(c *cli.Context, ki client.KeysAPI) { if len(c.Args()) == 0 { - handleError(c, ExitBadArgs, errors.New("key required")) + handleError(c, cobrautl.ExitBadArgs, errors.New("key required")) } key := c.Args()[0] recursive := c.Bool("recursive") @@ -55,7 +56,7 @@ func rmCommandFunc(c *cli.Context, ki client.KeysAPI) { resp, err := ki.Delete(ctx, key, &client.DeleteOptions{PrevIndex: uint64(prevIndex), PrevValue: prevValue, Dir: dir, Recursive: recursive}) cancel() if err != nil { - handleError(c, ExitServerError, err) + handleError(c, cobrautl.ExitServerError, err) } if !resp.Node.Dir || c.GlobalString("output") != "simple" { printResponseKey(resp, c.GlobalString("output")) diff --git a/etcdctl/ctlv2/command/rmdir_command.go b/etcdctl/ctlv2/command/rmdir_command.go index 09ca545e5b2..c7f5c8edd69 100644 --- a/etcdctl/ctlv2/command/rmdir_command.go +++ b/etcdctl/ctlv2/command/rmdir_command.go @@ -19,6 +19,7 @@ import ( "github.com/urfave/cli" "go.etcd.io/etcd/client/v2" + "go.etcd.io/etcd/pkg/v3/cobrautl" ) // NewRemoveDirCommand returns the CLI command for "rmdir". @@ -37,7 +38,7 @@ func NewRemoveDirCommand() cli.Command { // rmdirCommandFunc executes the "rmdir" command. func rmdirCommandFunc(c *cli.Context, ki client.KeysAPI) { if len(c.Args()) == 0 { - handleError(c, ExitBadArgs, errors.New("key required")) + handleError(c, cobrautl.ExitBadArgs, errors.New("key required")) } key := c.Args()[0] @@ -45,7 +46,7 @@ func rmdirCommandFunc(c *cli.Context, ki client.KeysAPI) { resp, err := ki.Delete(ctx, key, &client.DeleteOptions{Dir: true}) cancel() if err != nil { - handleError(c, ExitServerError, err) + handleError(c, cobrautl.ExitServerError, err) } if !resp.Node.Dir || c.GlobalString("output") != "simple" { diff --git a/etcdctl/ctlv2/command/set_command.go b/etcdctl/ctlv2/command/set_command.go index 619eef1362f..372c5b96cac 100644 --- a/etcdctl/ctlv2/command/set_command.go +++ b/etcdctl/ctlv2/command/set_command.go @@ -21,6 +21,7 @@ import ( "github.com/urfave/cli" "go.etcd.io/etcd/client/v2" + "go.etcd.io/etcd/pkg/v3/cobrautl" ) // NewSetCommand returns the CLI command for "set". @@ -50,12 +51,12 @@ func NewSetCommand() cli.Command { // setCommandFunc executes the "set" command. func setCommandFunc(c *cli.Context, ki client.KeysAPI) { if len(c.Args()) == 0 { - handleError(c, ExitBadArgs, errors.New("key required")) + handleError(c, cobrautl.ExitBadArgs, errors.New("key required")) } key := c.Args()[0] value, err := argOrStdin(c.Args(), os.Stdin, 1) if err != nil { - handleError(c, ExitBadArgs, errors.New("value required")) + handleError(c, cobrautl.ExitBadArgs, errors.New("value required")) } ttl := c.Int("ttl") @@ -66,7 +67,7 @@ func setCommandFunc(c *cli.Context, ki client.KeysAPI) { resp, err := ki.Set(ctx, key, value, &client.SetOptions{TTL: time.Duration(ttl) * time.Second, PrevIndex: uint64(prevIndex), PrevValue: prevValue}) cancel() if err != nil { - handleError(c, ExitServerError, err) + handleError(c, cobrautl.ExitServerError, err) } printResponseKey(resp, c.GlobalString("output")) diff --git a/etcdctl/ctlv2/command/update_command.go b/etcdctl/ctlv2/command/update_command.go index b429d5de3a6..71cd6ce662d 100644 --- a/etcdctl/ctlv2/command/update_command.go +++ b/etcdctl/ctlv2/command/update_command.go @@ -21,6 +21,7 @@ import ( "github.com/urfave/cli" "go.etcd.io/etcd/client/v2" + "go.etcd.io/etcd/pkg/v3/cobrautl" ) // NewUpdateCommand returns the CLI command for "update". @@ -42,12 +43,12 @@ func NewUpdateCommand() cli.Command { // updateCommandFunc executes the "update" command. func updateCommandFunc(c *cli.Context, ki client.KeysAPI) { if len(c.Args()) == 0 { - handleError(c, ExitBadArgs, errors.New("key required")) + handleError(c, cobrautl.ExitBadArgs, errors.New("key required")) } key := c.Args()[0] value, err := argOrStdin(c.Args(), os.Stdin, 1) if err != nil { - handleError(c, ExitBadArgs, errors.New("value required")) + handleError(c, cobrautl.ExitBadArgs, errors.New("value required")) } ttl := c.Int("ttl") @@ -56,7 +57,7 @@ func updateCommandFunc(c *cli.Context, ki client.KeysAPI) { resp, err := ki.Set(ctx, key, value, &client.SetOptions{TTL: time.Duration(ttl) * time.Second, PrevExist: client.PrevExist}) cancel() if err != nil { - handleError(c, ExitServerError, err) + handleError(c, cobrautl.ExitServerError, err) } printResponseKey(resp, c.GlobalString("output")) diff --git a/etcdctl/ctlv2/command/update_dir_command.go b/etcdctl/ctlv2/command/update_dir_command.go index 389e5814b77..e1fd61777b6 100644 --- a/etcdctl/ctlv2/command/update_dir_command.go +++ b/etcdctl/ctlv2/command/update_dir_command.go @@ -20,6 +20,7 @@ import ( "github.com/urfave/cli" "go.etcd.io/etcd/client/v2" + "go.etcd.io/etcd/pkg/v3/cobrautl" ) // NewUpdateDirCommand returns the CLI command for "updatedir". @@ -41,7 +42,7 @@ func NewUpdateDirCommand() cli.Command { // updatedirCommandFunc executes the "updatedir" command. func updatedirCommandFunc(c *cli.Context, ki client.KeysAPI) { if len(c.Args()) == 0 { - handleError(c, ExitBadArgs, errors.New("key required")) + handleError(c, cobrautl.ExitBadArgs, errors.New("key required")) } key := c.Args()[0] ttl := c.Int("ttl") @@ -49,7 +50,7 @@ func updatedirCommandFunc(c *cli.Context, ki client.KeysAPI) { resp, err := ki.Set(ctx, key, "", &client.SetOptions{TTL: time.Duration(ttl) * time.Second, Dir: true, PrevExist: client.PrevExist}) cancel() if err != nil { - handleError(c, ExitServerError, err) + handleError(c, cobrautl.ExitServerError, err) } if c.GlobalString("output") != "simple" { printResponseKey(resp, c.GlobalString("output")) diff --git a/etcdctl/ctlv2/command/util.go b/etcdctl/ctlv2/command/util.go index aff703e3c63..b80486b7ec0 100644 --- a/etcdctl/ctlv2/command/util.go +++ b/etcdctl/ctlv2/command/util.go @@ -30,6 +30,7 @@ import ( "go.etcd.io/etcd/client/pkg/v3/transport" "go.etcd.io/etcd/client/v2" + "go.etcd.io/etcd/pkg/v3/cobrautl" "github.com/bgentry/speakeasy" "github.com/urfave/cli" @@ -242,10 +243,10 @@ func mustNewClient(c *cli.Context) client.Client { if err == client.ErrNoEndpoints { fmt.Fprintf(os.Stderr, "etcd cluster has no published client endpoints.\n") fmt.Fprintf(os.Stderr, "Try '--no-sync' if you want to access non-published client endpoints(%s).\n", strings.Join(hc.Endpoints(), ",")) - handleError(c, ExitServerError, err) + handleError(c, cobrautl.ExitServerError, err) } if isConnectionError(err) { - handleError(c, ExitBadConnection, err) + handleError(c, cobrautl.ExitBadConnection, err) } } if debug { diff --git a/etcdctl/ctlv2/command/watch_command.go b/etcdctl/ctlv2/command/watch_command.go index 2fa79dd7cd6..3af28934216 100644 --- a/etcdctl/ctlv2/command/watch_command.go +++ b/etcdctl/ctlv2/command/watch_command.go @@ -22,6 +22,7 @@ import ( "os/signal" "go.etcd.io/etcd/client/v2" + "go.etcd.io/etcd/pkg/v3/cobrautl" "github.com/urfave/cli" ) @@ -47,7 +48,7 @@ func NewWatchCommand() cli.Command { // watchCommandFunc executes the "watch" command. func watchCommandFunc(c *cli.Context, ki client.KeysAPI) { if len(c.Args()) == 0 { - handleError(c, ExitBadArgs, errors.New("key required")) + handleError(c, cobrautl.ExitBadArgs, errors.New("key required")) } key := c.Args()[0] recursive := c.Bool("recursive") @@ -68,7 +69,7 @@ func watchCommandFunc(c *cli.Context, ki client.KeysAPI) { for !stop { resp, err := w.Next(context.TODO()) if err != nil { - handleError(c, ExitServerError, err) + handleError(c, cobrautl.ExitServerError, err) } if resp.Node.Dir { continue diff --git a/etcdctl/ctlv3/command/alarm_command.go b/etcdctl/ctlv3/command/alarm_command.go index 454e7693019..556ae11e3d0 100644 --- a/etcdctl/ctlv3/command/alarm_command.go +++ b/etcdctl/ctlv3/command/alarm_command.go @@ -19,6 +19,7 @@ import ( "github.com/spf13/cobra" v3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/pkg/v3/cobrautl" ) // NewAlarmCommand returns the cobra command for "alarm". @@ -46,13 +47,13 @@ func NewAlarmDisarmCommand() *cobra.Command { // alarmDisarmCommandFunc executes the "alarm disarm" command. func alarmDisarmCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 0 { - ExitWithError(ExitBadArgs, fmt.Errorf("alarm disarm command accepts no arguments")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("alarm disarm command accepts no arguments")) } ctx, cancel := commandCtx(cmd) resp, err := mustClientFromCmd(cmd).AlarmDisarm(ctx, &v3.AlarmMember{}) cancel() if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } display.Alarm(*resp) } @@ -69,13 +70,13 @@ func NewAlarmListCommand() *cobra.Command { // alarmListCommandFunc executes the "alarm list" command. func alarmListCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 0 { - ExitWithError(ExitBadArgs, fmt.Errorf("alarm list command accepts no arguments")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("alarm list command accepts no arguments")) } ctx, cancel := commandCtx(cmd) resp, err := mustClientFromCmd(cmd).AlarmList(ctx) cancel() if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } display.Alarm(*resp) } diff --git a/etcdctl/ctlv3/command/auth_command.go b/etcdctl/ctlv3/command/auth_command.go index 8a889c60dba..e163dc68198 100644 --- a/etcdctl/ctlv3/command/auth_command.go +++ b/etcdctl/ctlv3/command/auth_command.go @@ -19,6 +19,7 @@ import ( "github.com/spf13/cobra" "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" + "go.etcd.io/etcd/pkg/v3/cobrautl" ) // NewAuthCommand returns the cobra command for "auth". @@ -46,14 +47,14 @@ func newAuthStatusCommand() *cobra.Command { // authStatusCommandFunc executes the "auth status" command. func authStatusCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 0 { - ExitWithError(ExitBadArgs, fmt.Errorf("auth status command does not accept any arguments")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("auth status command does not accept any arguments")) } ctx, cancel := commandCtx(cmd) result, err := mustClientFromCmd(cmd).Auth.AuthStatus(ctx) cancel() if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } display.AuthStatus(*result) @@ -70,7 +71,7 @@ func newAuthEnableCommand() *cobra.Command { // authEnableCommandFunc executes the "auth enable" command. func authEnableCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 0 { - ExitWithError(ExitBadArgs, fmt.Errorf("auth enable command does not accept any arguments")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("auth enable command does not accept any arguments")) } ctx, cancel := commandCtx(cmd) @@ -91,7 +92,7 @@ func authEnableCommandFunc(cmd *cobra.Command, args []string) { } cancel() if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } fmt.Println("Authentication Enabled") @@ -108,14 +109,14 @@ func newAuthDisableCommand() *cobra.Command { // authDisableCommandFunc executes the "auth disable" command. func authDisableCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 0 { - ExitWithError(ExitBadArgs, fmt.Errorf("auth disable command does not accept any arguments")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("auth disable command does not accept any arguments")) } ctx, cancel := commandCtx(cmd) _, err := mustClientFromCmd(cmd).Auth.AuthDisable(ctx) cancel() if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } fmt.Println("Authentication Disabled") diff --git a/etcdctl/ctlv3/command/check.go b/etcdctl/ctlv3/command/check.go index a72b7fede87..a2a5ca31593 100644 --- a/etcdctl/ctlv3/command/check.go +++ b/etcdctl/ctlv3/command/check.go @@ -27,6 +27,7 @@ import ( "time" v3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/pkg/v3/cobrautl" "go.etcd.io/etcd/pkg/v3/report" "github.com/spf13/cobra" @@ -144,7 +145,7 @@ func newCheckPerfCommand(cmd *cobra.Command, args []string) { model, ok := checkPerfAlias[checkPerfLoad] if !ok { - ExitWithError(ExitBadFeature, fmt.Errorf("unknown load option %v", checkPerfLoad)) + cobrautl.ExitWithError(cobrautl.ExitBadFeature, fmt.Errorf("unknown load option %v", checkPerfLoad)) } cfg := checkPerfCfgMap[model] @@ -166,10 +167,10 @@ func newCheckPerfCommand(cmd *cobra.Command, args []string) { resp, err := clients[0].Get(gctx, checkPerfPrefix, v3.WithPrefix(), v3.WithLimit(1)) gcancel() if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } if len(resp.Kvs) > 0 { - ExitWithError(ExitInvalidInput, fmt.Errorf("prefix %q has keys. Delete with 'etcdctl del --prefix %s' first", checkPerfPrefix, checkPerfPrefix)) + cobrautl.ExitWithError(cobrautl.ExitInvalidInput, fmt.Errorf("prefix %q has keys. Delete with 'etcdctl del --prefix %s' first", checkPerfPrefix, checkPerfPrefix)) } ksize, vsize := 256, 1024 @@ -258,7 +259,7 @@ func newCheckPerfCommand(cmd *cobra.Command, args []string) { fmt.Println("PASS") } else { fmt.Println("FAIL") - os.Exit(ExitError) + os.Exit(cobrautl.ExitError) } } @@ -318,7 +319,7 @@ func newCheckDatascaleCommand(cmd *cobra.Command, args []string) { model, ok := checkDatascaleAlias[checkDatascaleLoad] if !ok { - ExitWithError(ExitBadFeature, fmt.Errorf("unknown load option %v", checkDatascaleLoad)) + cobrautl.ExitWithError(cobrautl.ExitBadFeature, fmt.Errorf("unknown load option %v", checkDatascaleLoad)) } cfg := checkDatascaleCfgMap[model] @@ -333,7 +334,7 @@ func newCheckDatascaleCommand(cmd *cobra.Command, args []string) { // get endpoints eps, errEndpoints := endpointsFromCmd(cmd) if errEndpoints != nil { - ExitWithError(ExitError, errEndpoints) + cobrautl.ExitWithError(cobrautl.ExitError, errEndpoints) } sec := secureCfgFromCmd(cmd) @@ -342,10 +343,10 @@ func newCheckDatascaleCommand(cmd *cobra.Command, args []string) { resp, err := clients[0].Get(ctx, checkDatascalePrefix, v3.WithPrefix(), v3.WithLimit(1)) cancel() if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } if len(resp.Kvs) > 0 { - ExitWithError(ExitInvalidInput, fmt.Errorf("prefix %q has keys. Delete with etcdctl del --prefix %s first", checkDatascalePrefix, checkDatascalePrefix)) + cobrautl.ExitWithError(cobrautl.ExitInvalidInput, fmt.Errorf("prefix %q has keys. Delete with etcdctl del --prefix %s first", checkDatascalePrefix, checkDatascalePrefix)) } ksize, vsize := 512, 512 @@ -359,7 +360,7 @@ func newCheckDatascaleCommand(cmd *cobra.Command, args []string) { bytesBefore := endpointMemoryMetrics(eps[0], sec) if bytesBefore == 0 { fmt.Println("FAIL: Could not read process_resident_memory_bytes before the put operations.") - os.Exit(ExitError) + os.Exit(cobrautl.ExitError) } fmt.Println(fmt.Sprintf("Start data scale check for work load [%v key-value pairs, %v bytes per key-value, %v concurrent clients].", cfg.limit, cfg.kvSize, cfg.clients)) @@ -397,7 +398,7 @@ func newCheckDatascaleCommand(cmd *cobra.Command, args []string) { bytesAfter := endpointMemoryMetrics(eps[0], sec) if bytesAfter == 0 { fmt.Println("FAIL: Could not read process_resident_memory_bytes after the put operations.") - os.Exit(ExitError) + os.Exit(cobrautl.ExitError) } // delete the created kv pairs @@ -405,7 +406,7 @@ func newCheckDatascaleCommand(cmd *cobra.Command, args []string) { dresp, derr := clients[0].Delete(ctx, checkDatascalePrefix, v3.WithPrefix()) defer cancel() if derr != nil { - ExitWithError(ExitError, derr) + cobrautl.ExitWithError(cobrautl.ExitError, derr) } if autoCompact { @@ -420,7 +421,7 @@ func newCheckDatascaleCommand(cmd *cobra.Command, args []string) { if bytesAfter == 0 { fmt.Println("FAIL: Could not read process_resident_memory_bytes after the put operations.") - os.Exit(ExitError) + os.Exit(cobrautl.ExitError) } bytesUsed := bytesAfter - bytesBefore @@ -431,7 +432,7 @@ func newCheckDatascaleCommand(cmd *cobra.Command, args []string) { for k, v := range s.ErrorDist { fmt.Printf("FAIL: ERROR(%v) -> %d\n", k, v) } - os.Exit(ExitError) + os.Exit(cobrautl.ExitError) } else { fmt.Println(fmt.Sprintf("PASS: Approximate system memory used : %v MB.", strconv.FormatFloat(mbUsed, 'f', 2, 64))) } diff --git a/etcdctl/ctlv3/command/compaction_command.go b/etcdctl/ctlv3/command/compaction_command.go index 9f1c1db0c69..b0b7c3118f3 100644 --- a/etcdctl/ctlv3/command/compaction_command.go +++ b/etcdctl/ctlv3/command/compaction_command.go @@ -20,6 +20,7 @@ import ( "github.com/spf13/cobra" "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/pkg/v3/cobrautl" ) var compactPhysical bool @@ -38,12 +39,12 @@ func NewCompactionCommand() *cobra.Command { // compactionCommandFunc executes the "compaction" command. func compactionCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 1 { - ExitWithError(ExitBadArgs, fmt.Errorf("compaction command needs 1 argument")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("compaction command needs 1 argument")) } rev, err := strconv.ParseInt(args[0], 10, 64) if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } var opts []clientv3.CompactOption @@ -56,7 +57,7 @@ func compactionCommandFunc(cmd *cobra.Command, args []string) { _, cerr := c.Compact(ctx, rev, opts...) cancel() if cerr != nil { - ExitWithError(ExitError, cerr) + cobrautl.ExitWithError(cobrautl.ExitError, cerr) } fmt.Println("compacted revision", rev) } diff --git a/etcdctl/ctlv3/command/defrag_command.go b/etcdctl/ctlv3/command/defrag_command.go index 058847574ac..2d92dc45843 100644 --- a/etcdctl/ctlv3/command/defrag_command.go +++ b/etcdctl/ctlv3/command/defrag_command.go @@ -21,6 +21,7 @@ import ( "time" "github.com/spf13/cobra" + "go.etcd.io/etcd/pkg/v3/cobrautl" "go.etcd.io/etcd/server/v3/mvcc/backend" ) @@ -45,7 +46,7 @@ func defragCommandFunc(cmd *cobra.Command, args []string) { err := defragData(defragDataDir) if err != nil { fmt.Fprintf(os.Stderr, "Failed to defragment etcd data[%s] (%v)\n", defragDataDir, err) - os.Exit(ExitError) + os.Exit(cobrautl.ExitError) } return } @@ -65,7 +66,7 @@ func defragCommandFunc(cmd *cobra.Command, args []string) { } if failures != 0 { - os.Exit(ExitError) + os.Exit(cobrautl.ExitError) } } diff --git a/etcdctl/ctlv3/command/del_command.go b/etcdctl/ctlv3/command/del_command.go index 644ea04632f..dbfd186dbad 100644 --- a/etcdctl/ctlv3/command/del_command.go +++ b/etcdctl/ctlv3/command/del_command.go @@ -19,6 +19,7 @@ import ( "github.com/spf13/cobra" "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/pkg/v3/cobrautl" ) var ( @@ -48,25 +49,25 @@ func delCommandFunc(cmd *cobra.Command, args []string) { resp, err := mustClientFromCmd(cmd).Delete(ctx, key, opts...) cancel() if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } display.Del(*resp) } func getDelOp(args []string) (string, []clientv3.OpOption) { if len(args) == 0 || len(args) > 2 { - ExitWithError(ExitBadArgs, fmt.Errorf("del command needs one argument as key and an optional argument as range_end")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("del command needs one argument as key and an optional argument as range_end")) } if delPrefix && delFromKey { - ExitWithError(ExitBadArgs, fmt.Errorf("`--prefix` and `--from-key` cannot be set at the same time, choose one")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("`--prefix` and `--from-key` cannot be set at the same time, choose one")) } opts := []clientv3.OpOption{} key := args[0] if len(args) > 1 { if delPrefix || delFromKey { - ExitWithError(ExitBadArgs, fmt.Errorf("too many arguments, only accept one argument when `--prefix` or `--from-key` is set")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("too many arguments, only accept one argument when `--prefix` or `--from-key` is set")) } opts = append(opts, clientv3.WithRange(args[1])) } diff --git a/etcdctl/ctlv3/command/elect_command.go b/etcdctl/ctlv3/command/elect_command.go index e1445cfec69..ae412f99e17 100644 --- a/etcdctl/ctlv3/command/elect_command.go +++ b/etcdctl/ctlv3/command/elect_command.go @@ -23,6 +23,7 @@ import ( "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/client/v3/concurrency" + "go.etcd.io/etcd/pkg/v3/cobrautl" "github.com/spf13/cobra" ) @@ -44,24 +45,24 @@ func NewElectCommand() *cobra.Command { func electCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 1 && len(args) != 2 { - ExitWithError(ExitBadArgs, errors.New("elect takes one election name argument and an optional proposal argument")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, errors.New("elect takes one election name argument and an optional proposal argument")) } c := mustClientFromCmd(cmd) var err error if len(args) == 1 { if !electListen { - ExitWithError(ExitBadArgs, errors.New("no proposal argument but -l not set")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, errors.New("no proposal argument but -l not set")) } err = observe(c, args[0]) } else { if electListen { - ExitWithError(ExitBadArgs, errors.New("proposal given but -l is set")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, errors.New("proposal given but -l is set")) } err = campaign(c, args[0], args[1]) } if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } } diff --git a/etcdctl/ctlv3/command/ep_command.go b/etcdctl/ctlv3/command/ep_command.go index 3f591e6800c..9e4aad04d8f 100644 --- a/etcdctl/ctlv3/command/ep_command.go +++ b/etcdctl/ctlv3/command/ep_command.go @@ -23,6 +23,7 @@ import ( "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" v3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/pkg/v3/cobrautl" "go.etcd.io/etcd/pkg/v3/flags" "github.com/spf13/cobra" @@ -89,7 +90,7 @@ type epHealth struct { func epHealthCommandFunc(cmd *cobra.Command, args []string) { lg, err := zap.NewProduction() if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } flags.SetPflagsFromEnv(lg, "ETCDCTL", cmd.InheritedFlags()) initDisplayFromCmd(cmd) @@ -103,7 +104,7 @@ func epHealthCommandFunc(cmd *cobra.Command, args []string) { for _, ep := range endpointsFromCluster(cmd) { cfg, err := newClientCfg([]string{ep}, dt, ka, kat, sec, auth) if err != nil { - ExitWithError(ExitBadArgs, err) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, err) } cfgs = append(cfgs, cfg) } @@ -172,7 +173,7 @@ func epHealthCommandFunc(cmd *cobra.Command, args []string) { } display.EndpointHealth(healthList) if errs { - ExitWithError(ExitError, fmt.Errorf("unhealthy cluster")) + cobrautl.ExitWithError(cobrautl.ExitError, fmt.Errorf("unhealthy cluster")) } } @@ -201,7 +202,7 @@ func epStatusCommandFunc(cmd *cobra.Command, args []string) { display.EndpointStatus(statusList) if err != nil { - os.Exit(ExitError) + os.Exit(cobrautl.ExitError) } } @@ -230,7 +231,7 @@ func epHashKVCommandFunc(cmd *cobra.Command, args []string) { display.EndpointHashKV(hashList) if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } } @@ -238,7 +239,7 @@ func endpointsFromCluster(cmd *cobra.Command) []string { if !epClusterEndpoints { endpoints, err := cmd.Flags().GetStringSlice("endpoints") if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } return endpoints } @@ -249,17 +250,17 @@ func endpointsFromCluster(cmd *cobra.Command) []string { kat := keepAliveTimeoutFromCmd(cmd) eps, err := endpointsFromCmd(cmd) if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } // exclude auth for not asking needless password (MemberList() doesn't need authentication) cfg, err := newClientCfg(eps, dt, ka, kat, sec, nil) if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } c, err := v3.New(*cfg) if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } ctx, cancel := commandCtx(cmd) @@ -270,7 +271,7 @@ func endpointsFromCluster(cmd *cobra.Command) []string { membs, err := c.MemberList(ctx) if err != nil { err = fmt.Errorf("failed to fetch endpoints from etcd cluster member list: %v", err) - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } ret := []string{} diff --git a/etcdctl/ctlv3/command/get_command.go b/etcdctl/ctlv3/command/get_command.go index d9ac7004a03..c94ac08b987 100644 --- a/etcdctl/ctlv3/command/get_command.go +++ b/etcdctl/ctlv3/command/get_command.go @@ -20,6 +20,7 @@ import ( "github.com/spf13/cobra" "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/pkg/v3/cobrautl" ) var ( @@ -63,19 +64,19 @@ func getCommandFunc(cmd *cobra.Command, args []string) { resp, err := mustClientFromCmd(cmd).Get(ctx, key, opts...) cancel() if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } if getCountOnly { if _, fields := display.(*fieldsPrinter); !fields { - ExitWithError(ExitBadArgs, fmt.Errorf("--count-only is only for `--write-out=fields`")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("--count-only is only for `--write-out=fields`")) } } if printValueOnly { dp, simple := (display).(*simplePrinter) if !simple { - ExitWithError(ExitBadArgs, fmt.Errorf("print-value-only is only for `--write-out=simple`")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("print-value-only is only for `--write-out=simple`")) } dp.valueOnly = true } @@ -84,15 +85,15 @@ func getCommandFunc(cmd *cobra.Command, args []string) { func getGetOp(args []string) (string, []clientv3.OpOption) { if len(args) == 0 { - ExitWithError(ExitBadArgs, fmt.Errorf("get command needs one argument as key and an optional argument as range_end")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("get command needs one argument as key and an optional argument as range_end")) } if getPrefix && getFromKey { - ExitWithError(ExitBadArgs, fmt.Errorf("`--prefix` and `--from-key` cannot be set at the same time, choose one")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("`--prefix` and `--from-key` cannot be set at the same time, choose one")) } if getKeysOnly && getCountOnly { - ExitWithError(ExitBadArgs, fmt.Errorf("`--keys-only` and `--count-only` cannot be set at the same time, choose one")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("`--keys-only` and `--count-only` cannot be set at the same time, choose one")) } opts := []clientv3.OpOption{} @@ -101,13 +102,13 @@ func getGetOp(args []string) (string, []clientv3.OpOption) { opts = append(opts, clientv3.WithSerializable()) case "l": default: - ExitWithError(ExitBadFeature, fmt.Errorf("unknown consistency flag %q", getConsistency)) + cobrautl.ExitWithError(cobrautl.ExitBadFeature, fmt.Errorf("unknown consistency flag %q", getConsistency)) } key := args[0] if len(args) > 1 { if getPrefix || getFromKey { - ExitWithError(ExitBadArgs, fmt.Errorf("too many arguments, only accept one argument when `--prefix` or `--from-key` is set")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("too many arguments, only accept one argument when `--prefix` or `--from-key` is set")) } opts = append(opts, clientv3.WithRange(args[1])) } @@ -127,7 +128,7 @@ func getGetOp(args []string) (string, []clientv3.OpOption) { case sortOrder == "": // nothing default: - ExitWithError(ExitBadFeature, fmt.Errorf("bad sort order %v", getSortOrder)) + cobrautl.ExitWithError(cobrautl.ExitBadFeature, fmt.Errorf("bad sort order %v", getSortOrder)) } sortByTarget := clientv3.SortByKey @@ -146,7 +147,7 @@ func getGetOp(args []string) (string, []clientv3.OpOption) { case sortTarget == "": // nothing default: - ExitWithError(ExitBadFeature, fmt.Errorf("bad sort target %v", getSortTarget)) + cobrautl.ExitWithError(cobrautl.ExitBadFeature, fmt.Errorf("bad sort target %v", getSortTarget)) } opts = append(opts, clientv3.WithSort(sortByTarget, sortByOrder)) diff --git a/etcdctl/ctlv3/command/global.go b/etcdctl/ctlv3/command/global.go index af10e82f8d1..c50ab5963a5 100644 --- a/etcdctl/ctlv3/command/global.go +++ b/etcdctl/ctlv3/command/global.go @@ -28,6 +28,7 @@ import ( "go.etcd.io/etcd/client/pkg/v3/srv" "go.etcd.io/etcd/client/pkg/v3/transport" "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/pkg/v3/cobrautl" "go.etcd.io/etcd/pkg/v3/flags" "github.com/spf13/cobra" @@ -86,14 +87,14 @@ var display printer = &simplePrinter{} func initDisplayFromCmd(cmd *cobra.Command) { isHex, err := cmd.Flags().GetBool("hex") if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } outputType, err := cmd.Flags().GetString("write-out") if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } if display = NewPrinter(outputType, isHex); display == nil { - ExitWithError(ExitBadFeature, errors.New("unsupported output format")) + cobrautl.ExitWithError(cobrautl.ExitBadFeature, errors.New("unsupported output format")) } } @@ -115,7 +116,7 @@ func (*discardValue) Type() string { return "" } func clientConfigFromCmd(cmd *cobra.Command) *clientConfig { lg, err := zap.NewProduction() if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } fs := cmd.InheritedFlags() if strings.HasPrefix(cmd.Use, "watch") { @@ -128,7 +129,7 @@ func clientConfigFromCmd(cmd *cobra.Command) *clientConfig { debug, err := cmd.Flags().GetBool("debug") if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } if debug { grpclog.SetLoggerV2(grpclog.NewLoggerV2WithVerbosity(os.Stderr, os.Stderr, os.Stderr, 4)) @@ -146,7 +147,7 @@ func clientConfigFromCmd(cmd *cobra.Command) *clientConfig { cfg := &clientConfig{} cfg.endpoints, err = endpointsFromCmd(cmd) if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } cfg.dialTimeout = dialTimeoutFromCmd(cmd) @@ -164,7 +165,7 @@ func mustClientCfgFromCmd(cmd *cobra.Command) *clientv3.Config { cc := clientConfigFromCmd(cmd) cfg, err := newClientCfg(cc.endpoints, cc.dialTimeout, cc.keepAliveTime, cc.keepAliveTimeout, cc.scfg, cc.acfg) if err != nil { - ExitWithError(ExitBadArgs, err) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, err) } return cfg } @@ -177,12 +178,12 @@ func mustClientFromCmd(cmd *cobra.Command) *clientv3.Client { func (cc *clientConfig) mustClient() *clientv3.Client { cfg, err := newClientCfg(cc.endpoints, cc.dialTimeout, cc.keepAliveTime, cc.keepAliveTimeout, cc.scfg, cc.acfg) if err != nil { - ExitWithError(ExitBadArgs, err) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, err) } client, err := clientv3.New(*cfg) if err != nil { - ExitWithError(ExitBadConnection, err) + cobrautl.ExitWithError(cobrautl.ExitBadConnection, err) } return client @@ -263,7 +264,7 @@ func argOrStdin(args []string, stdin io.Reader, i int) (string, error) { func dialTimeoutFromCmd(cmd *cobra.Command) time.Duration { dialTimeout, err := cmd.Flags().GetDuration("dial-timeout") if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } return dialTimeout } @@ -271,7 +272,7 @@ func dialTimeoutFromCmd(cmd *cobra.Command) time.Duration { func keepAliveTimeFromCmd(cmd *cobra.Command) time.Duration { keepAliveTime, err := cmd.Flags().GetDuration("keepalive-time") if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } return keepAliveTime } @@ -279,7 +280,7 @@ func keepAliveTimeFromCmd(cmd *cobra.Command) time.Duration { func keepAliveTimeoutFromCmd(cmd *cobra.Command) time.Duration { keepAliveTimeout, err := cmd.Flags().GetDuration("keepalive-timeout") if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } return keepAliveTimeout } @@ -308,7 +309,7 @@ func secureCfgFromCmd(cmd *cobra.Command) *secureCfg { func insecureTransportFromCmd(cmd *cobra.Command) bool { insecureTr, err := cmd.Flags().GetBool("insecure-transport") if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } return insecureTr } @@ -316,7 +317,7 @@ func insecureTransportFromCmd(cmd *cobra.Command) bool { func insecureSkipVerifyFromCmd(cmd *cobra.Command) bool { skipVerify, err := cmd.Flags().GetBool("insecure-skip-tls-verify") if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } return skipVerify } @@ -324,21 +325,21 @@ func insecureSkipVerifyFromCmd(cmd *cobra.Command) bool { func keyAndCertFromCmd(cmd *cobra.Command) (cert, key, cacert string) { var err error if cert, err = cmd.Flags().GetString("cert"); err != nil { - ExitWithError(ExitBadArgs, err) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, err) } else if cert == "" && cmd.Flags().Changed("cert") { - ExitWithError(ExitBadArgs, errors.New("empty string is passed to --cert option")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, errors.New("empty string is passed to --cert option")) } if key, err = cmd.Flags().GetString("key"); err != nil { - ExitWithError(ExitBadArgs, err) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, err) } else if key == "" && cmd.Flags().Changed("key") { - ExitWithError(ExitBadArgs, errors.New("empty string is passed to --key option")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, errors.New("empty string is passed to --key option")) } if cacert, err = cmd.Flags().GetString("cacert"); err != nil { - ExitWithError(ExitBadArgs, err) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, err) } else if cacert == "" && cmd.Flags().Changed("cacert") { - ExitWithError(ExitBadArgs, errors.New("empty string is passed to --cacert option")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, errors.New("empty string is passed to --cacert option")) } return cert, key, cacert @@ -347,11 +348,11 @@ func keyAndCertFromCmd(cmd *cobra.Command) (cert, key, cacert string) { func authCfgFromCmd(cmd *cobra.Command) *authCfg { userFlag, err := cmd.Flags().GetString("user") if err != nil { - ExitWithError(ExitBadArgs, err) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, err) } passwordFlag, err := cmd.Flags().GetString("password") if err != nil { - ExitWithError(ExitBadArgs, err) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, err) } if userFlag == "" { @@ -366,7 +367,7 @@ func authCfgFromCmd(cmd *cobra.Command) *authCfg { cfg.username = userFlag cfg.password, err = speakeasy.Ask("Password: ") if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } } else { cfg.username = splitted[0] @@ -383,7 +384,7 @@ func authCfgFromCmd(cmd *cobra.Command) *authCfg { func insecureDiscoveryFromCmd(cmd *cobra.Command) bool { discovery, err := cmd.Flags().GetBool("insecure-discovery") if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } return discovery } @@ -391,7 +392,7 @@ func insecureDiscoveryFromCmd(cmd *cobra.Command) bool { func discoverySrvFromCmd(cmd *cobra.Command) string { domainStr, err := cmd.Flags().GetString("discovery-srv") if err != nil { - ExitWithError(ExitBadArgs, err) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, err) } return domainStr } @@ -399,7 +400,7 @@ func discoverySrvFromCmd(cmd *cobra.Command) string { func discoveryDNSClusterServiceNameFromCmd(cmd *cobra.Command) string { serviceNameStr, err := cmd.Flags().GetString("discovery-srv-name") if err != nil { - ExitWithError(ExitBadArgs, err) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, err) } return serviceNameStr } diff --git a/etcdctl/ctlv3/command/lease_command.go b/etcdctl/ctlv3/command/lease_command.go index e9ee8714e85..97cacdfaf30 100644 --- a/etcdctl/ctlv3/command/lease_command.go +++ b/etcdctl/ctlv3/command/lease_command.go @@ -20,6 +20,7 @@ import ( "strconv" v3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/pkg/v3/cobrautl" "github.com/spf13/cobra" ) @@ -55,19 +56,19 @@ func NewLeaseGrantCommand() *cobra.Command { // leaseGrantCommandFunc executes the "lease grant" command. func leaseGrantCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 1 { - ExitWithError(ExitBadArgs, fmt.Errorf("lease grant command needs TTL argument")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("lease grant command needs TTL argument")) } ttl, err := strconv.ParseInt(args[0], 10, 64) if err != nil { - ExitWithError(ExitBadArgs, fmt.Errorf("bad TTL (%v)", err)) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("bad TTL (%v)", err)) } ctx, cancel := commandCtx(cmd) resp, err := mustClientFromCmd(cmd).Grant(ctx, ttl) cancel() if err != nil { - ExitWithError(ExitError, fmt.Errorf("failed to grant lease (%v)", err)) + cobrautl.ExitWithError(cobrautl.ExitError, fmt.Errorf("failed to grant lease (%v)", err)) } display.Grant(*resp) } @@ -87,7 +88,7 @@ func NewLeaseRevokeCommand() *cobra.Command { // leaseRevokeCommandFunc executes the "lease grant" command. func leaseRevokeCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 1 { - ExitWithError(ExitBadArgs, fmt.Errorf("lease revoke command needs 1 argument")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("lease revoke command needs 1 argument")) } id := leaseFromArgs(args[0]) @@ -95,7 +96,7 @@ func leaseRevokeCommandFunc(cmd *cobra.Command, args []string) { resp, err := mustClientFromCmd(cmd).Revoke(ctx, id) cancel() if err != nil { - ExitWithError(ExitError, fmt.Errorf("failed to revoke lease (%v)", err)) + cobrautl.ExitWithError(cobrautl.ExitError, fmt.Errorf("failed to revoke lease (%v)", err)) } display.Revoke(id, *resp) } @@ -118,7 +119,7 @@ func NewLeaseTimeToLiveCommand() *cobra.Command { // leaseTimeToLiveCommandFunc executes the "lease timetolive" command. func leaseTimeToLiveCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 1 { - ExitWithError(ExitBadArgs, fmt.Errorf("lease timetolive command needs lease ID as argument")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("lease timetolive command needs lease ID as argument")) } var opts []v3.LeaseOption if timeToLiveKeys { @@ -126,7 +127,7 @@ func leaseTimeToLiveCommandFunc(cmd *cobra.Command, args []string) { } resp, rerr := mustClientFromCmd(cmd).TimeToLive(context.TODO(), leaseFromArgs(args[0]), opts...) if rerr != nil { - ExitWithError(ExitBadConnection, rerr) + cobrautl.ExitWithError(cobrautl.ExitBadConnection, rerr) } display.TimeToLive(*resp, timeToLiveKeys) } @@ -145,7 +146,7 @@ func NewLeaseListCommand() *cobra.Command { func leaseListCommandFunc(cmd *cobra.Command, args []string) { resp, rerr := mustClientFromCmd(cmd).Leases(context.TODO()) if rerr != nil { - ExitWithError(ExitBadConnection, rerr) + cobrautl.ExitWithError(cobrautl.ExitBadConnection, rerr) } display.Leases(*resp) } @@ -163,7 +164,7 @@ func NewLeaseKeepAliveCommand() *cobra.Command { Run: leaseKeepAliveCommandFunc, } - lc.Flags().BoolVar(&leaseKeepAliveOnce, "once", false, "Resets the keep-alive time to its original value and exits immediately") + lc.Flags().BoolVar(&leaseKeepAliveOnce, "once", false, "Resets the keep-alive time to its original value and cobrautl.Exits immediately") return lc } @@ -171,7 +172,7 @@ func NewLeaseKeepAliveCommand() *cobra.Command { // leaseKeepAliveCommandFunc executes the "lease keep-alive" command. func leaseKeepAliveCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 1 { - ExitWithError(ExitBadArgs, fmt.Errorf("lease keep-alive command needs lease ID as argument")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("lease keep-alive command needs lease ID as argument")) } id := leaseFromArgs(args[0]) @@ -179,7 +180,7 @@ func leaseKeepAliveCommandFunc(cmd *cobra.Command, args []string) { if leaseKeepAliveOnce { respc, kerr := mustClientFromCmd(cmd).KeepAliveOnce(context.TODO(), id) if kerr != nil { - ExitWithError(ExitBadConnection, kerr) + cobrautl.ExitWithError(cobrautl.ExitBadConnection, kerr) } display.KeepAlive(*respc) return @@ -187,7 +188,7 @@ func leaseKeepAliveCommandFunc(cmd *cobra.Command, args []string) { respc, kerr := mustClientFromCmd(cmd).KeepAlive(context.TODO(), id) if kerr != nil { - ExitWithError(ExitBadConnection, kerr) + cobrautl.ExitWithError(cobrautl.ExitBadConnection, kerr) } for resp := range respc { display.KeepAlive(*resp) @@ -201,7 +202,7 @@ func leaseKeepAliveCommandFunc(cmd *cobra.Command, args []string) { func leaseFromArgs(arg string) v3.LeaseID { id, err := strconv.ParseInt(arg, 16, 64) if err != nil { - ExitWithError(ExitBadArgs, fmt.Errorf("bad lease ID arg (%v), expecting ID in Hex", err)) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("bad lease ID arg (%v), expecting ID in Hex", err)) } return v3.LeaseID(id) } diff --git a/etcdctl/ctlv3/command/lock_command.go b/etcdctl/ctlv3/command/lock_command.go index 8bbb16cfd0c..3b383ec9a2e 100644 --- a/etcdctl/ctlv3/command/lock_command.go +++ b/etcdctl/ctlv3/command/lock_command.go @@ -25,6 +25,7 @@ import ( "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/client/v3/concurrency" + "go.etcd.io/etcd/pkg/v3/cobrautl" "github.com/spf13/cobra" ) @@ -44,18 +45,18 @@ func NewLockCommand() *cobra.Command { func lockCommandFunc(cmd *cobra.Command, args []string) { if len(args) == 0 { - ExitWithError(ExitBadArgs, errors.New("lock takes a lock name argument and an optional command to execute")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, errors.New("lock takes a lock name argument and an optional command to execute")) } c := mustClientFromCmd(cmd) if err := lockUntilSignal(c, args[0], args[1:]); err != nil { code := getExitCodeFromError(err) - ExitWithError(code, err) + cobrautl.ExitWithError(code, err) } } func getExitCodeFromError(err error) int { if err == nil { - return ExitSuccess + return cobrautl.ExitSuccess } if exitErr, ok := err.(*exec.ExitError); ok { @@ -64,7 +65,7 @@ func getExitCodeFromError(err error) int { } } - return ExitError + return cobrautl.ExitError } func lockUntilSignal(c *clientv3.Client, lockname string, cmdArgs []string) error { diff --git a/etcdctl/ctlv3/command/make_mirror_command.go b/etcdctl/ctlv3/command/make_mirror_command.go index 12ec1e48738..aaa51eae9e7 100644 --- a/etcdctl/ctlv3/command/make_mirror_command.go +++ b/etcdctl/ctlv3/command/make_mirror_command.go @@ -23,6 +23,7 @@ import ( "time" "github.com/bgentry/speakeasy" + "go.etcd.io/etcd/pkg/v3/cobrautl" "go.etcd.io/etcd/api/v3/mvccpb" "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" @@ -80,7 +81,7 @@ func authDestCfg() *authCfg { cfg.username = mmuser cfg.password, err = speakeasy.Ask("Destination Password: ") if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } } else { cfg.username = splitted[0] @@ -96,7 +97,7 @@ func authDestCfg() *authCfg { func makeMirrorCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 1 { - ExitWithError(ExitBadArgs, errors.New("make-mirror takes one destination argument")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, errors.New("make-mirror takes one destination argument")) } dialTimeout := dialTimeoutFromCmd(cmd) @@ -123,7 +124,7 @@ func makeMirrorCommandFunc(cmd *cobra.Command, args []string) { c := mustClientFromCmd(cmd) err := makeMirror(context.TODO(), c, dc) - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } func makeMirror(ctx context.Context, c *clientv3.Client, dc *clientv3.Client) error { @@ -142,7 +143,7 @@ func makeMirror(ctx context.Context, c *clientv3.Client, dc *clientv3.Client) er // if destination prefix is specified and remove destination prefix is true return error if mmnodestprefix && len(mmdestprefix) > 0 { - ExitWithError(ExitBadArgs, fmt.Errorf("`--dest-prefix` and `--no-dest-prefix` cannot be set at the same time, choose one")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("`--dest-prefix` and `--no-dest-prefix` cannot be set at the same time, choose one")) } // if remove destination prefix is false and destination prefix is empty set the value of destination prefix same as prefix diff --git a/etcdctl/ctlv3/command/member_command.go b/etcdctl/ctlv3/command/member_command.go index 729af73a124..752f151673c 100644 --- a/etcdctl/ctlv3/command/member_command.go +++ b/etcdctl/ctlv3/command/member_command.go @@ -22,6 +22,7 @@ import ( "github.com/spf13/cobra" "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/pkg/v3/cobrautl" ) var ( @@ -118,7 +119,7 @@ func NewMemberPromoteCommand() *cobra.Command { // memberAddCommandFunc executes the "member add" command. func memberAddCommandFunc(cmd *cobra.Command, args []string) { if len(args) < 1 { - ExitWithError(ExitBadArgs, errors.New("member name not provided")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, errors.New("member name not provided")) } if len(args) > 1 { ev := "too many arguments" @@ -127,12 +128,12 @@ func memberAddCommandFunc(cmd *cobra.Command, args []string) { ev += fmt.Sprintf(`, did you mean --peer-urls=%s`, s) } } - ExitWithError(ExitBadArgs, errors.New(ev)) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, errors.New(ev)) } newMemberName := args[0] if len(memberPeerURLs) == 0 { - ExitWithError(ExitBadArgs, errors.New("member peer urls not provided")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, errors.New("member peer urls not provided")) } urls := strings.Split(memberPeerURLs, ",") @@ -149,7 +150,7 @@ func memberAddCommandFunc(cmd *cobra.Command, args []string) { } cancel() if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } newID := resp.Member.ID @@ -178,19 +179,19 @@ func memberAddCommandFunc(cmd *cobra.Command, args []string) { // memberRemoveCommandFunc executes the "member remove" command. func memberRemoveCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 1 { - ExitWithError(ExitBadArgs, fmt.Errorf("member ID is not provided")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("member ID is not provided")) } id, err := strconv.ParseUint(args[0], 16, 64) if err != nil { - ExitWithError(ExitBadArgs, fmt.Errorf("bad member ID arg (%v), expecting ID in Hex", err)) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("bad member ID arg (%v), expecting ID in Hex", err)) } ctx, cancel := commandCtx(cmd) resp, err := mustClientFromCmd(cmd).MemberRemove(ctx, id) cancel() if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } display.MemberRemove(id, *resp) } @@ -198,16 +199,16 @@ func memberRemoveCommandFunc(cmd *cobra.Command, args []string) { // memberUpdateCommandFunc executes the "member update" command. func memberUpdateCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 1 { - ExitWithError(ExitBadArgs, fmt.Errorf("member ID is not provided")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("member ID is not provided")) } id, err := strconv.ParseUint(args[0], 16, 64) if err != nil { - ExitWithError(ExitBadArgs, fmt.Errorf("bad member ID arg (%v), expecting ID in Hex", err)) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("bad member ID arg (%v), expecting ID in Hex", err)) } if len(memberPeerURLs) == 0 { - ExitWithError(ExitBadArgs, fmt.Errorf("member peer urls not provided")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("member peer urls not provided")) } urls := strings.Split(memberPeerURLs, ",") @@ -216,7 +217,7 @@ func memberUpdateCommandFunc(cmd *cobra.Command, args []string) { resp, err := mustClientFromCmd(cmd).MemberUpdate(ctx, id, urls) cancel() if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } display.MemberUpdate(id, *resp) @@ -228,7 +229,7 @@ func memberListCommandFunc(cmd *cobra.Command, args []string) { resp, err := mustClientFromCmd(cmd).MemberList(ctx) cancel() if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } display.MemberList(*resp) @@ -237,19 +238,19 @@ func memberListCommandFunc(cmd *cobra.Command, args []string) { // memberPromoteCommandFunc executes the "member promote" command. func memberPromoteCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 1 { - ExitWithError(ExitBadArgs, fmt.Errorf("member ID is not provided")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("member ID is not provided")) } id, err := strconv.ParseUint(args[0], 16, 64) if err != nil { - ExitWithError(ExitBadArgs, fmt.Errorf("bad member ID arg (%v), expecting ID in Hex", err)) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("bad member ID arg (%v), expecting ID in Hex", err)) } ctx, cancel := commandCtx(cmd) resp, err := mustClientFromCmd(cmd).MemberPromote(ctx, id) cancel() if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } display.MemberPromote(id, *resp) } diff --git a/etcdctl/ctlv3/command/migrate_command.go b/etcdctl/ctlv3/command/migrate_command.go index ff68165608c..0ebdc95ea5b 100644 --- a/etcdctl/ctlv3/command/migrate_command.go +++ b/etcdctl/ctlv3/command/migrate_command.go @@ -28,6 +28,7 @@ import ( "go.etcd.io/etcd/api/v3/mvccpb" "go.etcd.io/etcd/client/pkg/v3/types" "go.etcd.io/etcd/client/v2" + "go.etcd.io/etcd/pkg/v3/cobrautl" "go.etcd.io/etcd/pkg/v3/pbutil" "go.etcd.io/etcd/raft/v3/raftpb" "go.etcd.io/etcd/server/v3/etcdserver" @@ -96,7 +97,7 @@ func migrateCommandFunc(cmd *cobra.Command, args []string) { err := <-errc if err != nil { fmt.Println("failed to transform keys") - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } fmt.Println("finished transforming keys") @@ -139,7 +140,7 @@ func rebuildStoreV2() (st v2store.Store, index uint64, term uint64) { ss := snap.New(zap.NewExample(), snapdir) snapshot, err := ss.Load() if err != nil && err != snap.ErrNoSnapshot { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } var walsnap walpb.Snapshot @@ -151,20 +152,20 @@ func rebuildStoreV2() (st v2store.Store, index uint64, term uint64) { w, err := wal.OpenForRead(zap.NewExample(), waldir, walsnap) if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } defer w.Close() _, _, ents, err := w.ReadAll() if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } st = v2store.New() if snapshot != nil { err := st.Recovery(snapshot.Data) if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } } @@ -248,7 +249,7 @@ func writeStore(w io.Writer, st v2store.Store) uint64 { fmt.Println("no v2 keys to migrate") os.Exit(0) } - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } return writeKeys(w, all.Node) } @@ -268,7 +269,7 @@ func writeKeys(w io.Writer, n *v2store.NodeExtern) uint64 { if !migrateExcludeTTLKey || n.TTL == 0 { b, err := json.Marshal(n) if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } fmt.Fprint(w, string(b)) } @@ -318,16 +319,16 @@ func startTransformer() (io.WriteCloser, io.ReadCloser, chan error) { writer, err := cmd.StdinPipe() if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } reader, rerr := cmd.StdoutPipe() if rerr != nil { - ExitWithError(ExitError, rerr) + cobrautl.ExitWithError(cobrautl.ExitError, rerr) } if err := cmd.Start(); err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } errc := make(chan error, 1) diff --git a/etcdctl/ctlv3/command/move_leader_command.go b/etcdctl/ctlv3/command/move_leader_command.go index 1aee99b2444..098c897cd7a 100644 --- a/etcdctl/ctlv3/command/move_leader_command.go +++ b/etcdctl/ctlv3/command/move_leader_command.go @@ -20,6 +20,7 @@ import ( "github.com/spf13/cobra" "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/pkg/v3/cobrautl" ) // NewMoveLeaderCommand returns the cobra command for "move-leader". @@ -35,11 +36,11 @@ func NewMoveLeaderCommand() *cobra.Command { // transferLeadershipCommandFunc executes the "compaction" command. func transferLeadershipCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 1 { - ExitWithError(ExitBadArgs, fmt.Errorf("move-leader command needs 1 argument")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("move-leader command needs 1 argument")) } target, err := strconv.ParseUint(args[0], 16, 64) if err != nil { - ExitWithError(ExitBadArgs, err) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, err) } c := mustClientFromCmd(cmd) @@ -57,7 +58,7 @@ func transferLeadershipCommandFunc(cmd *cobra.Command, args []string) { cli := cfg.mustClient() resp, serr := cli.Status(ctx, ep) if serr != nil { - ExitWithError(ExitError, serr) + cobrautl.ExitWithError(cobrautl.ExitError, serr) } if resp.Header.GetMemberId() == resp.Leader { @@ -68,14 +69,14 @@ func transferLeadershipCommandFunc(cmd *cobra.Command, args []string) { cli.Close() } if leaderCli == nil { - ExitWithError(ExitBadArgs, fmt.Errorf("no leader endpoint given at %v", eps)) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("no leader endpoint given at %v", eps)) } var resp *clientv3.MoveLeaderResponse resp, err = leaderCli.MoveLeader(ctx, target) cancel() if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } display.MoveLeader(leaderID, target, *resp) diff --git a/etcdctl/ctlv3/command/printer.go b/etcdctl/ctlv3/command/printer.go index 869d580f944..7a77a968c7e 100644 --- a/etcdctl/ctlv3/command/printer.go +++ b/etcdctl/ctlv3/command/printer.go @@ -22,6 +22,7 @@ import ( pb "go.etcd.io/etcd/api/v3/etcdserverpb" v3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/etcdctl/v3/snapshot" + "go.etcd.io/etcd/pkg/v3/cobrautl" "github.com/dustin/go-humanize" ) @@ -151,7 +152,7 @@ type printerUnsupported struct{ printerRPC } func newPrinterUnsupported(n string) printer { f := func(interface{}) { - ExitWithError(ExitBadFeature, errors.New(n+" not supported as output format")) + cobrautl.ExitWithError(cobrautl.ExitBadFeature, errors.New(n+" not supported as output format")) } return &printerUnsupported{printerRPC{nil, f}} } diff --git a/etcdctl/ctlv3/command/printer_protobuf.go b/etcdctl/ctlv3/command/printer_protobuf.go index ee6c413ffb4..da1da9f3441 100644 --- a/etcdctl/ctlv3/command/printer_protobuf.go +++ b/etcdctl/ctlv3/command/printer_protobuf.go @@ -21,6 +21,7 @@ import ( pb "go.etcd.io/etcd/api/v3/etcdserverpb" mvccpb "go.etcd.io/etcd/api/v3/mvccpb" v3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/pkg/v3/cobrautl" ) type pbPrinter struct{ printer } @@ -53,7 +54,7 @@ func (p *pbPrinter) Watch(r v3.WatchResponse) { func printPB(v interface{}) { m, ok := v.(pbMarshal) if !ok { - ExitWithError(ExitBadFeature, fmt.Errorf("marshal unsupported for type %T (%v)", v, v)) + cobrautl.ExitWithError(cobrautl.ExitBadFeature, fmt.Errorf("marshal unsupported for type %T (%v)", v, v)) } b, err := m.Marshal() if err != nil { diff --git a/etcdctl/ctlv3/command/put_command.go b/etcdctl/ctlv3/command/put_command.go index 2877510c62d..35eb32148d6 100644 --- a/etcdctl/ctlv3/command/put_command.go +++ b/etcdctl/ctlv3/command/put_command.go @@ -21,6 +21,7 @@ import ( "github.com/spf13/cobra" "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/pkg/v3/cobrautl" ) var ( @@ -71,19 +72,19 @@ func putCommandFunc(cmd *cobra.Command, args []string) { resp, err := mustClientFromCmd(cmd).Put(ctx, key, value, opts...) cancel() if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } display.Put(*resp) } func getPutOp(args []string) (string, string, []clientv3.OpOption) { if len(args) == 0 { - ExitWithError(ExitBadArgs, fmt.Errorf("put command needs 1 argument and input from stdin or 2 arguments")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("put command needs 1 argument and input from stdin or 2 arguments")) } key := args[0] if putIgnoreVal && len(args) > 1 { - ExitWithError(ExitBadArgs, fmt.Errorf("put command needs only 1 argument when 'ignore-value' is set")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("put command needs only 1 argument when 'ignore-value' is set")) } var value string @@ -91,13 +92,13 @@ func getPutOp(args []string) (string, string, []clientv3.OpOption) { if !putIgnoreVal { value, err = argOrStdin(args, os.Stdin, 1) if err != nil { - ExitWithError(ExitBadArgs, fmt.Errorf("put command needs 1 argument and input from stdin or 2 arguments")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("put command needs 1 argument and input from stdin or 2 arguments")) } } id, err := strconv.ParseInt(leaseStr, 16, 64) if err != nil { - ExitWithError(ExitBadArgs, fmt.Errorf("bad lease ID (%v), expecting ID in Hex", err)) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("bad lease ID (%v), expecting ID in Hex", err)) } opts := []clientv3.OpOption{} diff --git a/etcdctl/ctlv3/command/role_command.go b/etcdctl/ctlv3/command/role_command.go index 21b1031bed7..885f11fdb34 100644 --- a/etcdctl/ctlv3/command/role_command.go +++ b/etcdctl/ctlv3/command/role_command.go @@ -20,6 +20,7 @@ import ( "github.com/spf13/cobra" "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/pkg/v3/cobrautl" ) var ( @@ -105,12 +106,12 @@ func newRoleRevokePermissionCommand() *cobra.Command { // roleAddCommandFunc executes the "role add" command. func roleAddCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 1 { - ExitWithError(ExitBadArgs, fmt.Errorf("role add command requires role name as its argument")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("role add command requires role name as its argument")) } resp, err := mustClientFromCmd(cmd).Auth.RoleAdd(context.TODO(), args[0]) if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } display.RoleAdd(args[0], *resp) @@ -119,12 +120,12 @@ func roleAddCommandFunc(cmd *cobra.Command, args []string) { // roleDeleteCommandFunc executes the "role delete" command. func roleDeleteCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 1 { - ExitWithError(ExitBadArgs, fmt.Errorf("role delete command requires role name as its argument")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("role delete command requires role name as its argument")) } resp, err := mustClientFromCmd(cmd).Auth.RoleDelete(context.TODO(), args[0]) if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } display.RoleDelete(args[0], *resp) @@ -133,13 +134,13 @@ func roleDeleteCommandFunc(cmd *cobra.Command, args []string) { // roleGetCommandFunc executes the "role get" command. func roleGetCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 1 { - ExitWithError(ExitBadArgs, fmt.Errorf("role get command requires role name as its argument")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("role get command requires role name as its argument")) } name := args[0] resp, err := mustClientFromCmd(cmd).Auth.RoleGet(context.TODO(), name) if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } display.RoleGet(name, *resp) @@ -148,12 +149,12 @@ func roleGetCommandFunc(cmd *cobra.Command, args []string) { // roleListCommandFunc executes the "role list" command. func roleListCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 0 { - ExitWithError(ExitBadArgs, fmt.Errorf("role list command requires no arguments")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("role list command requires no arguments")) } resp, err := mustClientFromCmd(cmd).Auth.RoleList(context.TODO()) if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } display.RoleList(*resp) @@ -162,18 +163,18 @@ func roleListCommandFunc(cmd *cobra.Command, args []string) { // roleGrantPermissionCommandFunc executes the "role grant-permission" command. func roleGrantPermissionCommandFunc(cmd *cobra.Command, args []string) { if len(args) < 3 { - ExitWithError(ExitBadArgs, fmt.Errorf("role grant command requires role name, permission type, and key [endkey] as its argument")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("role grant command requires role name, permission type, and key [endkey] as its argument")) } perm, err := clientv3.StrToPermissionType(args[1]) if err != nil { - ExitWithError(ExitBadArgs, err) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, err) } key, rangeEnd := permRange(args[2:]) resp, err := mustClientFromCmd(cmd).Auth.RoleGrantPermission(context.TODO(), args[0], key, rangeEnd, perm) if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } display.RoleGrantPermission(args[0], *resp) @@ -182,13 +183,13 @@ func roleGrantPermissionCommandFunc(cmd *cobra.Command, args []string) { // roleRevokePermissionCommandFunc executes the "role revoke-permission" command. func roleRevokePermissionCommandFunc(cmd *cobra.Command, args []string) { if len(args) < 2 { - ExitWithError(ExitBadArgs, fmt.Errorf("role revoke-permission command requires role name and key [endkey] as its argument")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("role revoke-permission command requires role name and key [endkey] as its argument")) } key, rangeEnd := permRange(args[1:]) resp, err := mustClientFromCmd(cmd).Auth.RoleRevokePermission(context.TODO(), args[0], key, rangeEnd) if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } display.RoleRevokePermission(args[0], args[1], rangeEnd, *resp) } @@ -198,7 +199,7 @@ func permRange(args []string) (string, string) { var rangeEnd string if len(key) == 0 { if rolePermPrefix && rolePermFromKey { - ExitWithError(ExitBadArgs, fmt.Errorf("--from-key and --prefix flags are mutually exclusive")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("--from-key and --prefix flags are mutually exclusive")) } // Range permission is expressed as adt.BytesAffineInterval, @@ -214,7 +215,7 @@ func permRange(args []string) (string, string) { var err error rangeEnd, err = rangeEndFromPermFlags(args[0:]) if err != nil { - ExitWithError(ExitBadArgs, err) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, err) } } return key, rangeEnd diff --git a/etcdctl/ctlv3/command/snapshot_command.go b/etcdctl/ctlv3/command/snapshot_command.go index c1d14bd63ea..181626d33cc 100644 --- a/etcdctl/ctlv3/command/snapshot_command.go +++ b/etcdctl/ctlv3/command/snapshot_command.go @@ -21,6 +21,7 @@ import ( "strings" "go.etcd.io/etcd/etcdctl/v3/snapshot" + "go.etcd.io/etcd/pkg/v3/cobrautl" "github.com/spf13/cobra" "go.uber.org/zap" @@ -92,12 +93,12 @@ func NewSnapshotRestoreCommand() *cobra.Command { func snapshotSaveCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 1 { err := fmt.Errorf("snapshot save expects one argument") - ExitWithError(ExitBadArgs, err) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, err) } lg, err := zap.NewProduction() if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } sp := snapshot.NewV3(lg) cfg := mustClientCfgFromCmd(cmd) @@ -111,7 +112,7 @@ func snapshotSaveCommandFunc(cmd *cobra.Command, args []string) { path := args[0] if err := sp.Save(ctx, *cfg, path); err != nil { - ExitWithError(ExitInterrupted, err) + cobrautl.ExitWithError(cobrautl.ExitInterrupted, err) } fmt.Printf("Snapshot saved at %s\n", path) } @@ -119,18 +120,18 @@ func snapshotSaveCommandFunc(cmd *cobra.Command, args []string) { func snapshotStatusCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 1 { err := fmt.Errorf("snapshot status requires exactly one argument") - ExitWithError(ExitBadArgs, err) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, err) } initDisplayFromCmd(cmd) lg, err := zap.NewProduction() if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } sp := snapshot.NewV3(lg) ds, err := sp.Status(args[0]) if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } display.DBStatus(ds) } @@ -138,7 +139,7 @@ func snapshotStatusCommandFunc(cmd *cobra.Command, args []string) { func snapshotRestoreCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 1 { err := fmt.Errorf("snapshot restore requires exactly one argument") - ExitWithError(ExitBadArgs, err) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, err) } dataDir := restoreDataDir @@ -153,7 +154,7 @@ func snapshotRestoreCommandFunc(cmd *cobra.Command, args []string) { lg, err := zap.NewProduction() if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } sp := snapshot.NewV3(lg) @@ -167,7 +168,7 @@ func snapshotRestoreCommandFunc(cmd *cobra.Command, args []string) { InitialClusterToken: restoreClusterToken, SkipHashCheck: skipHashCheck, }); err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } } diff --git a/etcdctl/ctlv3/command/txn_command.go b/etcdctl/ctlv3/command/txn_command.go index 82d7bd86e09..e20b6d95a8e 100644 --- a/etcdctl/ctlv3/command/txn_command.go +++ b/etcdctl/ctlv3/command/txn_command.go @@ -24,6 +24,7 @@ import ( pb "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/pkg/v3/cobrautl" "github.com/spf13/cobra" ) @@ -44,7 +45,7 @@ func NewTxnCommand() *cobra.Command { // txnCommandFunc executes the "txn" command. func txnCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 0 { - ExitWithError(ExitBadArgs, fmt.Errorf("txn command does not accept argument")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("txn command does not accept argument")) } reader := bufio.NewReader(os.Stdin) @@ -59,7 +60,7 @@ func txnCommandFunc(cmd *cobra.Command, args []string) { resp, err := txn.Commit() if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } display.Txn(*resp) @@ -75,7 +76,7 @@ func readCompares(r *bufio.Reader) (cmps []clientv3.Cmp) { for { line, err := r.ReadString('\n') if err != nil { - ExitWithError(ExitInvalidInput, err) + cobrautl.ExitWithError(cobrautl.ExitInvalidInput, err) } // remove space from the line @@ -86,7 +87,7 @@ func readCompares(r *bufio.Reader) (cmps []clientv3.Cmp) { cmp, err := parseCompare(line) if err != nil { - ExitWithError(ExitInvalidInput, err) + cobrautl.ExitWithError(cobrautl.ExitInvalidInput, err) } cmps = append(cmps, *cmp) } @@ -98,7 +99,7 @@ func readOps(r *bufio.Reader) (ops []clientv3.Op) { for { line, err := r.ReadString('\n') if err != nil { - ExitWithError(ExitInvalidInput, err) + cobrautl.ExitWithError(cobrautl.ExitInvalidInput, err) } // remove space from the line @@ -109,7 +110,7 @@ func readOps(r *bufio.Reader) (ops []clientv3.Op) { op, err := parseRequestUnion(line) if err != nil { - ExitWithError(ExitInvalidInput, err) + cobrautl.ExitWithError(cobrautl.ExitInvalidInput, err) } ops = append(ops, *op) } diff --git a/etcdctl/ctlv3/command/user_command.go b/etcdctl/ctlv3/command/user_command.go index 6a763395f2c..ced3af72190 100644 --- a/etcdctl/ctlv3/command/user_command.go +++ b/etcdctl/ctlv3/command/user_command.go @@ -22,6 +22,7 @@ import ( "github.com/bgentry/speakeasy" "github.com/spf13/cobra" "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/pkg/v3/cobrautl" ) var ( @@ -125,7 +126,7 @@ func newUserRevokeRoleCommand() *cobra.Command { // userAddCommandFunc executes the "user add" command. func userAddCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 1 { - ExitWithError(ExitBadArgs, fmt.Errorf("user add command requires user name as its argument")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("user add command requires user name as its argument")) } var password string @@ -152,7 +153,7 @@ func userAddCommandFunc(cmd *cobra.Command, args []string) { user = splitted[0] password = splitted[1] if len(user) == 0 { - ExitWithError(ExitBadArgs, fmt.Errorf("empty user name is not allowed")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("empty user name is not allowed")) } } } @@ -163,7 +164,7 @@ func userAddCommandFunc(cmd *cobra.Command, args []string) { resp, err := mustClientFromCmd(cmd).Auth.UserAddWithOptions(context.TODO(), user, password, options) if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } display.UserAdd(user, *resp) @@ -172,12 +173,12 @@ func userAddCommandFunc(cmd *cobra.Command, args []string) { // userDeleteCommandFunc executes the "user delete" command. func userDeleteCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 1 { - ExitWithError(ExitBadArgs, fmt.Errorf("user delete command requires user name as its argument")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("user delete command requires user name as its argument")) } resp, err := mustClientFromCmd(cmd).Auth.UserDelete(context.TODO(), args[0]) if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } display.UserDelete(args[0], *resp) } @@ -185,14 +186,14 @@ func userDeleteCommandFunc(cmd *cobra.Command, args []string) { // userGetCommandFunc executes the "user get" command. func userGetCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 1 { - ExitWithError(ExitBadArgs, fmt.Errorf("user get command requires user name as its argument")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("user get command requires user name as its argument")) } name := args[0] client := mustClientFromCmd(cmd) resp, err := client.Auth.UserGet(context.TODO(), name) if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } if userShowDetail { @@ -201,7 +202,7 @@ func userGetCommandFunc(cmd *cobra.Command, args []string) { fmt.Printf("\n") roleResp, err := client.Auth.RoleGet(context.TODO(), role) if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } display.RoleGet(role, *roleResp) } @@ -213,12 +214,12 @@ func userGetCommandFunc(cmd *cobra.Command, args []string) { // userListCommandFunc executes the "user list" command. func userListCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 0 { - ExitWithError(ExitBadArgs, fmt.Errorf("user list command requires no arguments")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("user list command requires no arguments")) } resp, err := mustClientFromCmd(cmd).Auth.UserList(context.TODO()) if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } display.UserList(*resp) @@ -227,7 +228,7 @@ func userListCommandFunc(cmd *cobra.Command, args []string) { // userChangePasswordCommandFunc executes the "user passwd" command. func userChangePasswordCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 1 { - ExitWithError(ExitBadArgs, fmt.Errorf("user passwd command requires user name as its argument")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("user passwd command requires user name as its argument")) } var password string @@ -240,7 +241,7 @@ func userChangePasswordCommandFunc(cmd *cobra.Command, args []string) { resp, err := mustClientFromCmd(cmd).Auth.UserChangePassword(context.TODO(), args[0], password) if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } display.UserChangePassword(*resp) @@ -249,12 +250,12 @@ func userChangePasswordCommandFunc(cmd *cobra.Command, args []string) { // userGrantRoleCommandFunc executes the "user grant-role" command. func userGrantRoleCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 2 { - ExitWithError(ExitBadArgs, fmt.Errorf("user grant command requires user name and role name as its argument")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("user grant command requires user name and role name as its argument")) } resp, err := mustClientFromCmd(cmd).Auth.UserGrantRole(context.TODO(), args[0], args[1]) if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } display.UserGrantRole(args[0], args[1], *resp) @@ -263,12 +264,12 @@ func userGrantRoleCommandFunc(cmd *cobra.Command, args []string) { // userRevokeRoleCommandFunc executes the "user revoke-role" command. func userRevokeRoleCommandFunc(cmd *cobra.Command, args []string) { if len(args) != 2 { - ExitWithError(ExitBadArgs, fmt.Errorf("user revoke-role requires user name and role name as its argument")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("user revoke-role requires user name and role name as its argument")) } resp, err := mustClientFromCmd(cmd).Auth.UserRevokeRole(context.TODO(), args[0], args[1]) if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } display.UserRevokeRole(args[0], args[1], *resp) @@ -278,21 +279,21 @@ func readPasswordInteractive(name string) string { prompt1 := fmt.Sprintf("Password of %s: ", name) password1, err1 := speakeasy.Ask(prompt1) if err1 != nil { - ExitWithError(ExitBadArgs, fmt.Errorf("failed to ask password: %s", err1)) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("failed to ask password: %s", err1)) } if len(password1) == 0 { - ExitWithError(ExitBadArgs, fmt.Errorf("empty password")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("empty password")) } prompt2 := fmt.Sprintf("Type password of %s again for confirmation: ", name) password2, err2 := speakeasy.Ask(prompt2) if err2 != nil { - ExitWithError(ExitBadArgs, fmt.Errorf("failed to ask password: %s", err2)) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("failed to ask password: %s", err2)) } if password1 != password2 { - ExitWithError(ExitBadArgs, fmt.Errorf("given passwords are different")) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("given passwords are different")) } return password1 diff --git a/etcdctl/ctlv3/command/util.go b/etcdctl/ctlv3/command/util.go index 230b2b2d116..cd15fd33952 100644 --- a/etcdctl/ctlv3/command/util.go +++ b/etcdctl/ctlv3/command/util.go @@ -28,6 +28,7 @@ import ( pb "go.etcd.io/etcd/api/v3/mvccpb" v3 "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/pkg/v3/cobrautl" "github.com/spf13/cobra" ) @@ -68,7 +69,7 @@ func argify(s string) []string { } else if args[i][0] == '"' { // "double quoted string" if _, err := fmt.Sscanf(args[i], "%q", &args[i]); err != nil { - ExitWithError(ExitInvalidInput, err) + cobrautl.ExitWithError(cobrautl.ExitInvalidInput, err) } } } @@ -78,7 +79,7 @@ func argify(s string) []string { func commandCtx(cmd *cobra.Command) (context.Context, context.CancelFunc) { timeOut, err := cmd.Flags().GetDuration("command-timeout") if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } return context.WithTimeout(context.Background(), timeOut) } @@ -149,7 +150,7 @@ func compact(c *v3.Client, rev int64) { _, err := c.Compact(ctx, rev, v3.WithCompactPhysical()) cancel() if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } fmt.Printf("Compacted with revision %d\n", rev) } @@ -161,7 +162,7 @@ func defrag(c *v3.Client, ep string) { _, err := c.Defragment(ctx, ep) cancel() if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } fmt.Printf("Defragmented %q\n", ep) } diff --git a/etcdctl/ctlv3/command/watch_command.go b/etcdctl/ctlv3/command/watch_command.go index 1bfc479b149..28826500483 100644 --- a/etcdctl/ctlv3/command/watch_command.go +++ b/etcdctl/ctlv3/command/watch_command.go @@ -24,6 +24,7 @@ import ( "strings" "go.etcd.io/etcd/client/v3" + "go.etcd.io/etcd/pkg/v3/cobrautl" "github.com/spf13/cobra" ) @@ -64,7 +65,7 @@ func NewWatchCommand() *cobra.Command { func watchCommandFunc(cmd *cobra.Command, args []string) { envKey, envRange := os.Getenv("ETCDCTL_WATCH_KEY"), os.Getenv("ETCDCTL_WATCH_RANGE_END") if envKey == "" && envRange != "" { - ExitWithError(ExitBadArgs, fmt.Errorf("ETCDCTL_WATCH_KEY is empty but got ETCDCTL_WATCH_RANGE_END=%q", envRange)) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("ETCDCTL_WATCH_KEY is empty but got ETCDCTL_WATCH_RANGE_END=%q", envRange)) } if watchInteractive { @@ -74,20 +75,20 @@ func watchCommandFunc(cmd *cobra.Command, args []string) { watchArgs, execArgs, err := parseWatchArgs(os.Args, args, envKey, envRange, false) if err != nil { - ExitWithError(ExitBadArgs, err) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, err) } c := mustClientFromCmd(cmd) wc, err := getWatchChan(c, watchArgs) if err != nil { - ExitWithError(ExitBadArgs, err) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, err) } printWatchCh(c, wc, execArgs) if err = c.Close(); err != nil { - ExitWithError(ExitBadConnection, err) + cobrautl.ExitWithError(cobrautl.ExitBadConnection, err) } - ExitWithError(ExitInterrupted, fmt.Errorf("watch is canceled by the server")) + cobrautl.ExitWithError(cobrautl.ExitInterrupted, fmt.Errorf("watch is canceled by the server")) } func watchInteractiveFunc(cmd *cobra.Command, osArgs []string, envKey, envRange string) { @@ -98,7 +99,7 @@ func watchInteractiveFunc(cmd *cobra.Command, osArgs []string, envKey, envRange for { l, err := reader.ReadString('\n') if err != nil { - ExitWithError(ExitInvalidInput, fmt.Errorf("error reading watch request line: %v", err)) + cobrautl.ExitWithError(cobrautl.ExitInvalidInput, fmt.Errorf("error reading watch request line: %v", err)) } l = strings.TrimSuffix(l, "\n") @@ -115,7 +116,7 @@ func watchInteractiveFunc(cmd *cobra.Command, osArgs []string, envKey, envRange } watchArgs, execArgs, perr := parseWatchArgs(osArgs, args, envKey, envRange, true) if perr != nil { - ExitWithError(ExitBadArgs, perr) + cobrautl.ExitWithError(cobrautl.ExitBadArgs, perr) } ch, err := getWatchChan(c, watchArgs) @@ -127,7 +128,7 @@ func watchInteractiveFunc(cmd *cobra.Command, osArgs []string, envKey, envRange case "progress": err := c.RequestProgress(clientv3.WithRequireLeader(context.Background())) if err != nil { - ExitWithError(ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } default: fmt.Fprintf(os.Stderr, "Invalid command %s (only support watch)\n", l) diff --git a/etcdctl/ctlv3/ctl.go b/etcdctl/ctlv3/ctl.go index 64cf617b995..5dc7ca8c77d 100644 --- a/etcdctl/ctlv3/ctl.go +++ b/etcdctl/ctlv3/ctl.go @@ -18,7 +18,9 @@ package ctlv3 import ( "time" + "go.etcd.io/etcd/api/v3/version" "go.etcd.io/etcd/etcdctl/v3/ctlv3/command" + "go.etcd.io/etcd/pkg/v3/cobrautl" "github.com/spf13/cobra" ) @@ -95,6 +97,10 @@ func init() { ) } +func usageFunc(c *cobra.Command) error { + return cobrautl.UsageFunc(c, version.Version, version.APIVersion) +} + func Start() error { rootCmd.SetUsageFunc(usageFunc) // Make help just show the usage @@ -104,7 +110,7 @@ func Start() error { func MustStart() { if err := Start(); err != nil { - command.ExitWithError(command.ExitError, err) + cobrautl.ExitWithError(cobrautl.ExitError, err) } } diff --git a/etcdctl/go.mod b/etcdctl/go.mod index 51984d75b6c..6899a8c21ee 100644 --- a/etcdctl/go.mod +++ b/etcdctl/go.mod @@ -7,7 +7,7 @@ require ( github.com/dustin/go-humanize v1.0.0 github.com/gogo/protobuf v1.3.2 github.com/olekukonko/tablewriter v0.0.4 - github.com/spf13/cobra v1.1.1 + github.com/spf13/cobra v1.1.3 github.com/spf13/pflag v1.0.5 github.com/urfave/cli v1.22.4 go.etcd.io/bbolt v1.3.6-0.20210426205525-9c92be978ae0 diff --git a/etcdctl/go.sum b/etcdctl/go.sum index bb9baa4be0d..6c234341ee4 100644 --- a/etcdctl/go.sum +++ b/etcdctl/go.sum @@ -265,8 +265,8 @@ github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v1.1.1 h1:KfztREH0tPxJJ+geloSLaAkaPkr4ki2Er5quFV1TDo4= -github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= +github.com/spf13/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M= +github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= @@ -508,8 +508,9 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/go.mod b/go.mod index 150b8300d9f..45ee9e8613c 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/bgentry/speakeasy v0.1.0 github.com/dustin/go-humanize v1.0.0 github.com/mattn/go-runewidth v0.0.9 // indirect - github.com/spf13/cobra v1.1.1 + github.com/spf13/cobra v1.1.3 go.etcd.io/bbolt v1.3.6-0.20210426205525-9c92be978ae0 go.etcd.io/etcd/api/v3 v3.5.0-alpha.0 go.etcd.io/etcd/client/pkg/v3 v3.5.0-alpha.0 diff --git a/go.sum b/go.sum index 7f33ad40151..4127bc5c6fa 100644 --- a/go.sum +++ b/go.sum @@ -273,8 +273,8 @@ github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v1.1.1 h1:KfztREH0tPxJJ+geloSLaAkaPkr4ki2Er5quFV1TDo4= -github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= +github.com/spf13/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M= +github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= @@ -525,8 +525,8 @@ gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/etcdctl/ctlv3/command/error.go b/pkg/cobrautl/error.go similarity index 87% rename from etcdctl/ctlv3/command/error.go rename to pkg/cobrautl/error.go index e5006f92df5..a01ca48d392 100644 --- a/etcdctl/ctlv3/command/error.go +++ b/pkg/cobrautl/error.go @@ -12,13 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -package command +package cobrautl import ( "fmt" "os" - - "go.etcd.io/etcd/client/v2" ) const ( @@ -31,12 +29,12 @@ const ( ExitInterrupted ExitIO ExitBadArgs = 128 + + ExitServerError = 4 + ExitClusterNotHealthy = 5 ) func ExitWithError(code int, err error) { fmt.Fprintln(os.Stderr, "Error:", err) - if cerr, ok := err.(*client.ClusterError); ok { - fmt.Fprintln(os.Stderr, cerr.Detail()) - } os.Exit(code) } diff --git a/etcdctl/ctlv3/help.go b/pkg/cobrautl/help.go similarity index 96% rename from etcdctl/ctlv3/help.go rename to pkg/cobrautl/help.go index 331e20cdd37..44cdc9aa886 100644 --- a/etcdctl/ctlv3/help.go +++ b/pkg/cobrautl/help.go @@ -14,7 +14,7 @@ // copied from https://github.com/rkt/rkt/blob/master/rkt/help.go -package ctlv3 +package cobrautl import ( "bytes" @@ -25,8 +25,6 @@ import ( "text/tabwriter" "text/template" - "go.etcd.io/etcd/api/v3/version" - "github.com/spf13/cobra" "github.com/spf13/pflag" ) @@ -146,7 +144,7 @@ func getSubCommands(cmd *cobra.Command) []*cobra.Command { return subCommands } -func usageFunc(cmd *cobra.Command) error { +func UsageFunc(cmd *cobra.Command, version, APIVersion string) error { subCommands := getSubCommands(cmd) tabOut := getTabOutWithWriter(os.Stdout) commandUsageTemplate.Execute(tabOut, struct { @@ -161,8 +159,8 @@ func usageFunc(cmd *cobra.Command) error { etcdFlagUsages(cmd.LocalFlags()), etcdFlagUsages(cmd.InheritedFlags()), subCommands, - version.Version, - version.APIVersion, + version, + APIVersion, }) tabOut.Flush() return nil diff --git a/pkg/go.mod b/pkg/go.mod index df2dd4b102e..fefe20c1c02 100644 --- a/pkg/go.mod +++ b/pkg/go.mod @@ -6,6 +6,7 @@ require ( github.com/creack/pty v1.1.11 github.com/dustin/go-humanize v1.0.0 github.com/golang/protobuf v1.5.1 // indirect + github.com/spf13/cobra v1.1.3 github.com/spf13/pflag v1.0.5 go.etcd.io/etcd/client/pkg/v3 v3.5.0-alpha.0 go.uber.org/zap v1.16.1-0.20210329175301-c23abee72d19 diff --git a/pkg/go.sum b/pkg/go.sum index c1ddab5885a..e88c8cb9379 100644 --- a/pkg/go.sum +++ b/pkg/go.sum @@ -1,24 +1,70 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.3.1/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw= github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= @@ -30,6 +76,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.1 h1:jAbXjIeW2ZSW2AwFxlGTDoc2CjI2XujLkV3ArsZFCvc= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -37,58 +85,240 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M= +github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.16.1-0.20210329175301-c23abee72d19 h1:040c3dLNhgFQkoojH2AMpHCy4SrvhmxdU72d9GLGGE0= go.uber.org/zap v1.16.1-0.20210329175301-c23abee72d19/go.mod h1:aMfIlz3TDBfB0BwTCKFU1XbEmj9zevr5S5LcBr85MXw= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57 h1:F5Gozwx4I1xtr/sr/8CFbb57iKi3297KFs0QDbGN60A= golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= @@ -106,8 +336,21 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/server/go.mod b/server/go.mod index de1e30f657c..bb83c7d26bd 100644 --- a/server/go.mod +++ b/server/go.mod @@ -22,7 +22,7 @@ require ( github.com/prometheus/procfs v0.2.0 // indirect github.com/sirupsen/logrus v1.7.0 // indirect github.com/soheilhy/cmux v0.1.5 - github.com/spf13/cobra v1.1.1 + github.com/spf13/cobra v1.1.3 github.com/stretchr/testify v1.7.0 github.com/tmc/grpc-websocket-proxy v0.0.0-20200427203606-3cfed13b9966 github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 diff --git a/server/go.sum b/server/go.sum index bec69b79bc6..21191643ad3 100644 --- a/server/go.sum +++ b/server/go.sum @@ -263,8 +263,8 @@ github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v1.1.1 h1:KfztREH0tPxJJ+geloSLaAkaPkr4ki2Er5quFV1TDo4= -github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= +github.com/spf13/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M= +github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= @@ -510,8 +510,9 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/tests/go.mod b/tests/go.mod index 588647af917..a2b63ed301e 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -24,7 +24,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/prometheus/client_golang v1.5.1 github.com/soheilhy/cmux v0.1.5 - github.com/spf13/cobra v1.1.1 + github.com/spf13/cobra v1.1.3 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.7.0 go.etcd.io/bbolt v1.3.6-0.20210426205525-9c92be978ae0 @@ -41,5 +41,5 @@ require ( golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba google.golang.org/grpc v1.37.0 - gopkg.in/yaml.v2 v2.3.0 + gopkg.in/yaml.v2 v2.4.0 ) diff --git a/tests/go.sum b/tests/go.sum index c7ffc673a52..e999c243663 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -269,8 +269,8 @@ github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v1.1.1 h1:KfztREH0tPxJJ+geloSLaAkaPkr4ki2Er5quFV1TDo4= -github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= +github.com/spf13/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M= +github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= @@ -520,8 +520,8 @@ gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=