@@ -17,6 +17,7 @@ limitations under the License.
17
17
package cmd
18
18
19
19
import (
20
+ "errors"
20
21
"fmt"
21
22
"io"
22
23
"os"
@@ -70,7 +71,7 @@ var extractCmd = &cobra.Command{
70
71
Short : "Extracts kubernetes data from the boltdb '.db' files etcd persists to." ,
71
72
Long : extractLong ,
72
73
Example : extractExample ,
73
- RunE : func (cmd * cobra.Command , args []string ) error {
74
+ RunE : func (_ * cobra.Command , _ []string ) error {
74
75
return extractValidateAndRun ()
75
76
},
76
77
}
@@ -160,17 +161,17 @@ func extractValidateAndRun() error {
160
161
}
161
162
return printLeafItemValue (kv , outMediaType , out )
162
163
case hasKey && hasKeyPrefix :
163
- return fmt . Errorf ("--keys-by-prefix and --key may not be used together" )
164
+ return errors . New ("--keys-by-prefix and --key may not be used together" )
164
165
case hasKey && opts .listVersions :
165
166
return printVersions (opts .filename , opts .key , out )
166
167
case hasKey :
167
168
return printValue (opts .filename , opts .key , opts .version , opts .raw , outMediaType , out )
168
169
case ! hasKey && opts .listVersions :
169
- return fmt . Errorf ("--list-versions may only be used with --key" )
170
+ return errors . New ("--list-versions may only be used with --key" )
170
171
case ! hasKey && hasVersion :
171
- return fmt . Errorf ("--version may only be used with --key" )
172
+ return errors . New ("--version may only be used with --key" )
172
173
case hasTemplate && hasFields :
173
- return fmt . Errorf ("--template and --fields may not be used together" )
174
+ return errors . New ("--template and --fields may not be used together" )
174
175
case hasTemplate :
175
176
return printTemplateSummaries (opts .filename , opts .keyPrefix , opts .revision , opts .template , opts .filter , out )
176
177
default :
@@ -216,7 +217,7 @@ func printValue(filename string, key string, version string, raw bool, outMediaT
216
217
return err
217
218
}
218
219
if len (in ) == 0 {
219
- return fmt . Errorf ("0 byte value" )
220
+ return errors . New ("0 byte value" )
220
221
}
221
222
if raw {
222
223
fmt .Fprintf (out , "%s\n " , string (in ))
@@ -259,7 +260,7 @@ func printLeafItemValue(kv *mvccpb.KeyValue, outMediaType string, out io.Writer)
259
260
// printKeySummaries prints all keys in the db file with the given key prefix.
260
261
func printKeySummaries (filename string , keyPrefix string , revision int64 , fields []string , out io.Writer ) error {
261
262
if len (fields ) == 0 {
262
- return fmt . Errorf ("no fields provided, nothing to output" )
263
+ return errors . New ("no fields provided, nothing to output" )
263
264
}
264
265
265
266
var hasKey bool
@@ -297,7 +298,7 @@ func printTemplateSummaries(filename string, keyPrefix string, revision int64, t
297
298
}
298
299
299
300
if len (templatestr ) == 0 {
300
- return fmt . Errorf ("no template provided, nothing to output" )
301
+ return errors . New ("no template provided, nothing to output" )
301
302
}
302
303
303
304
filters := []data.Filter {}
0 commit comments