core/commands: config: Simplified some syntax
Matt Bell committed
Jan 22, 2015 at 23:12 UTC
79741438d9b351460b2baad3665fd00024565b41
1 file changed
+10
-15
core/commands/config.go
+10
-15
@@ -68,24 +68,19 @@ Set the value of the 'datastore.path' key:
68
}
69
defer r.Close()
70
71
- var value string
71
+ var err error
72
+ var output *ConfigField
73
if len(args) == 2 {
73
- value = args[1]
74
- output, err := setConfig(r, key, value)
75
- if err != nil {
76
- res.SetError(err, cmds.ErrNormal)
77
- return
78
- }
79
- res.SetOutput(output)
80
-
74
+ value := args[1]
75
+ output, err = setConfig(r, key, value)
76
} else {
82
- output, err := getConfig(r, key)
83
- if err != nil {
84
- res.SetError(err, cmds.ErrNormal)
85
- return
86
- }
87
- res.SetOutput(output)
77
+ output, err = getConfig(r, key)
78
}
79
+ if err != nil {
80
+ res.SetError(err, cmds.ErrNormal)
81
+ return
82
+ }
83
+ res.SetOutput(output)
84
},
85
Marshalers: cmds.MarshalerMap{
86
cmds.Text: func(res cmds.Response) (io.Reader, error) {