Browse Source

etcdctl: update to meet go vet

Brian Waldon 11 years ago
parent
commit
1539d5c49c

+ 2 - 4
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 {

+ 2 - 2
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)

+ 1 - 1
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)

+ 1 - 1
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)

+ 1 - 1
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)

+ 4 - 4
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)

+ 3 - 3
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)

+ 1 - 1
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)

+ 1 - 1
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)

+ 1 - 1
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)

+ 3 - 3
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)

+ 4 - 4
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(),