From 1539d5c49c1c797b8c150b0afa75d3691966a0c4 Mon Sep 17 00:00:00 2001 From: Brian Waldon Date: Wed, 22 Oct 2014 17:51:40 -0700 Subject: [PATCH] etcdctl: update to meet go vet --- etcdctl/command/exec_watch_command.go | 6 ++---- etcdctl/command/get_command.go | 4 ++-- etcdctl/command/ls_command.go | 2 +- etcdctl/command/mk_command.go | 2 +- etcdctl/command/mkdir_command.go | 2 +- etcdctl/command/rm_command.go | 8 ++++---- etcdctl/command/set_command.go | 6 +++--- etcdctl/command/set_dir_command.go | 2 +- etcdctl/command/update_command.go | 2 +- etcdctl/command/update_dir_command.go | 2 +- etcdctl/command/watch_command.go | 6 +++--- etcdctl/main.go | 8 ++++---- 12 files changed, 24 insertions(+), 26 deletions(-) diff --git a/etcdctl/command/exec_watch_command.go b/etcdctl/command/exec_watch_command.go index d96ffde62..a71721bbb 100644 --- a/etcdctl/command/exec_watch_command.go +++ b/etcdctl/command/exec_watch_command.go @@ -18,8 +18,8 @@ func NewExecWatchCommand() cli.Command { Name: "exec-watch", Usage: "watch a key for changes and exec an executable", Flags: []cli.Flag{ - cli.IntFlag{"after-index", 0, "watch after the given index"}, - cli.BoolFlag{"recursive", "watch all values for key and child keys"}, + cli.IntFlag{Name: "after-index", Value: 0, Usage: "watch after the given index"}, + cli.BoolFlag{Name: "recursive", Usage: "watch all values for key and child keys"}, }, Action: func(c *cli.Context) { handleKey(c, execWatchCommandFunc) @@ -92,8 +92,6 @@ func execWatchCommandFunc(c *cli.Context, client *etcd.Client) (*etcd.Response, go io.Copy(os.Stderr, stderr) cmd.Wait() } - - return nil, nil } func environResponse(resp *etcd.Response, env []string) []string { diff --git a/etcdctl/command/get_command.go b/etcdctl/command/get_command.go index 696cd3751..c1b4f3f02 100644 --- a/etcdctl/command/get_command.go +++ b/etcdctl/command/get_command.go @@ -15,8 +15,8 @@ func NewGetCommand() cli.Command { Name: "get", Usage: "retrieve the value of a key", Flags: []cli.Flag{ - cli.BoolFlag{"sort", "returns result in sorted order"}, - cli.BoolFlag{"consistent", "send request to the leader, thereby guranteeing that any earlier writes will be seen by the read"}, + cli.BoolFlag{Name: "sort", Usage: "returns result in sorted order"}, + cli.BoolFlag{Name: "consistent", Usage: "send request to the leader, thereby guranteeing that any earlier writes will be seen by the read"}, }, Action: func(c *cli.Context) { handleGet(c, getCommandFunc) diff --git a/etcdctl/command/ls_command.go b/etcdctl/command/ls_command.go index 12bd89f9f..7f15fd718 100644 --- a/etcdctl/command/ls_command.go +++ b/etcdctl/command/ls_command.go @@ -12,7 +12,7 @@ func NewLsCommand() cli.Command { Name: "ls", Usage: "retrieve a directory", Flags: []cli.Flag{ - cli.BoolFlag{"recursive", "returns all values for key and child keys"}, + cli.BoolFlag{Name: "recursive", Usage: "returns all values for key and child keys"}, }, Action: func(c *cli.Context) { handleLs(c, lsCommandFunc) diff --git a/etcdctl/command/mk_command.go b/etcdctl/command/mk_command.go index 7050c013b..9920e9bb6 100644 --- a/etcdctl/command/mk_command.go +++ b/etcdctl/command/mk_command.go @@ -14,7 +14,7 @@ func NewMakeCommand() cli.Command { Name: "mk", Usage: "make a new key with a given value", Flags: []cli.Flag{ - cli.IntFlag{"ttl", 0, "key time-to-live"}, + cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"}, }, Action: func(c *cli.Context) { handleKey(c, makeCommandFunc) diff --git a/etcdctl/command/mkdir_command.go b/etcdctl/command/mkdir_command.go index 3b096d7fa..16979e70d 100644 --- a/etcdctl/command/mkdir_command.go +++ b/etcdctl/command/mkdir_command.go @@ -13,7 +13,7 @@ func NewMakeDirCommand() cli.Command { Name: "mkdir", Usage: "make a new directory", Flags: []cli.Flag{ - cli.IntFlag{"ttl", 0, "key time-to-live"}, + cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"}, }, Action: func(c *cli.Context) { handleDir(c, makeDirCommandFunc) diff --git a/etcdctl/command/rm_command.go b/etcdctl/command/rm_command.go index d5ba3a9a5..baff9cb16 100644 --- a/etcdctl/command/rm_command.go +++ b/etcdctl/command/rm_command.go @@ -13,10 +13,10 @@ func NewRemoveCommand() cli.Command { Name: "rm", Usage: "remove a key", Flags: []cli.Flag{ - cli.BoolFlag{"dir", "removes the key if it is an empty directory or a key-value pair"}, - cli.BoolFlag{"recursive", "removes the key and all child keys(if it is a directory)"}, - cli.StringFlag{"with-value", "", "previous value"}, - cli.IntFlag{"with-index", 0, "previous index"}, + cli.BoolFlag{Name: "dir", Usage: "removes the key if it is an empty directory or a key-value pair"}, + cli.BoolFlag{Name: "recursive", Usage: "removes the key and all child keys(if it is a directory)"}, + cli.StringFlag{Name: "with-value", Value: "", Usage: "previous value"}, + cli.IntFlag{Name: "with-index", Value: 0, Usage: "previous index"}, }, Action: func(c *cli.Context) { handleAll(c, removeCommandFunc) diff --git a/etcdctl/command/set_command.go b/etcdctl/command/set_command.go index 0ca2525fe..e745f1d61 100644 --- a/etcdctl/command/set_command.go +++ b/etcdctl/command/set_command.go @@ -14,9 +14,9 @@ func NewSetCommand() cli.Command { Name: "set", Usage: "set the value of a key", Flags: []cli.Flag{ - cli.IntFlag{"ttl", 0, "key time-to-live"}, - cli.StringFlag{"swap-with-value", "", "previous value"}, - cli.IntFlag{"swap-with-index", 0, "previous index"}, + cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"}, + cli.StringFlag{Name: "swap-with-value", Value: "", Usage: "previous value"}, + cli.IntFlag{Name: "swap-with-index", Value: 0, Usage: "previous index"}, }, Action: func(c *cli.Context) { handleKey(c, setCommandFunc) diff --git a/etcdctl/command/set_dir_command.go b/etcdctl/command/set_dir_command.go index 101b6908a..6a5b36aa4 100644 --- a/etcdctl/command/set_dir_command.go +++ b/etcdctl/command/set_dir_command.go @@ -13,7 +13,7 @@ func NewSetDirCommand() cli.Command { Name: "setdir", Usage: "create a new or existing directory", Flags: []cli.Flag{ - cli.IntFlag{"ttl", 0, "key time-to-live"}, + cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"}, }, Action: func(c *cli.Context) { handleDir(c, setDirCommandFunc) diff --git a/etcdctl/command/update_command.go b/etcdctl/command/update_command.go index 47594b73a..47ea5db47 100644 --- a/etcdctl/command/update_command.go +++ b/etcdctl/command/update_command.go @@ -14,7 +14,7 @@ func NewUpdateCommand() cli.Command { Name: "update", Usage: "update an existing key with a given value", Flags: []cli.Flag{ - cli.IntFlag{"ttl", 0, "key time-to-live"}, + cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"}, }, Action: func(c *cli.Context) { handleKey(c, updateCommandFunc) diff --git a/etcdctl/command/update_dir_command.go b/etcdctl/command/update_dir_command.go index f13333d91..548de8cc3 100644 --- a/etcdctl/command/update_dir_command.go +++ b/etcdctl/command/update_dir_command.go @@ -13,7 +13,7 @@ func NewUpdateDirCommand() cli.Command { Name: "updatedir", Usage: "update an existing directory", Flags: []cli.Flag{ - cli.IntFlag{"ttl", 0, "key time-to-live"}, + cli.IntFlag{Name: "ttl", Value: 0, Usage: "key time-to-live"}, }, Action: func(c *cli.Context) { handleDir(c, updateDirCommandFunc) diff --git a/etcdctl/command/watch_command.go b/etcdctl/command/watch_command.go index 8f7f873d2..60bc86531 100644 --- a/etcdctl/command/watch_command.go +++ b/etcdctl/command/watch_command.go @@ -15,9 +15,9 @@ func NewWatchCommand() cli.Command { Name: "watch", Usage: "watch a key for changes", Flags: []cli.Flag{ - cli.BoolFlag{"forever", "forever watch a key until CTRL+C"}, - cli.IntFlag{"after-index", 0, "watch after the given index"}, - cli.BoolFlag{"recursive", "returns all values for key and child keys"}, + cli.BoolFlag{Name: "forever", Usage: "forever watch a key until CTRL+C"}, + cli.IntFlag{Name: "after-index", Value: 0, Usage: "watch after the given index"}, + cli.BoolFlag{Name: "recursive", Usage: "returns all values for key and child keys"}, }, Action: func(c *cli.Context) { handleKey(c, watchCommandFunc) diff --git a/etcdctl/main.go b/etcdctl/main.go index 552a208b7..0bdaf2cad 100644 --- a/etcdctl/main.go +++ b/etcdctl/main.go @@ -15,10 +15,10 @@ func main() { app.Version = version.Version app.Usage = "A simple command line client for etcd." app.Flags = []cli.Flag{ - cli.BoolFlag{"debug", "output cURL commands which can be used to reproduce the request"}, - cli.BoolFlag{"no-sync", "don't synchronize cluster information before sending request"}, - cli.StringFlag{"output, o", "simple", "output response in the given format (`simple` or `json`)"}, - cli.StringFlag{"peers, C", "", "a comma-delimited list of machine addresses in the cluster (default: \"127.0.0.1:4001\")"}, + cli.BoolFlag{Name: "debug", Usage: "output cURL commands which can be used to reproduce the request"}, + cli.BoolFlag{Name: "no-sync", Usage: "don't synchronize cluster information before sending request"}, + cli.StringFlag{Name: "output, o", Value: "simple", Usage: "output response in the given format (`simple` or `json`)"}, + cli.StringFlag{Name: "peers, C", Value: "", Usage: "a comma-delimited list of machine addresses in the cluster (default: \"127.0.0.1:4001\")"}, } app.Commands = []cli.Command{ command.NewMakeCommand(),