mirror of
https://github.com/etcd-io/bbolt.git
synced 2025-05-31 11:42:30 +00:00
Fixing golangci warnings.
Signed-off-by: Piotr Tabor <ptab@google.com>
This commit is contained in:
parent
5495c633ad
commit
4acf9d93a5
@ -537,7 +537,7 @@ func formatBytes(b []byte, format string) (string, error) {
|
|||||||
case "hex":
|
case "hex":
|
||||||
return fmt.Sprintf("%x", b), nil
|
return fmt.Sprintf("%x", b), nil
|
||||||
case "bytes":
|
case "bytes":
|
||||||
return fmt.Sprintf("%s", b), nil
|
return string(b), nil
|
||||||
default:
|
default:
|
||||||
return "", fmt.Errorf("formatBytes: unsupported format: %s", format)
|
return "", fmt.Errorf("formatBytes: unsupported format: %s", format)
|
||||||
}
|
}
|
||||||
@ -1200,16 +1200,13 @@ func (cmd *KeysCommand) Run(args ...string) error {
|
|||||||
|
|
||||||
// Iterate over each key.
|
// Iterate over each key.
|
||||||
return lastbucket.ForEach(func(key, _ []byte) error {
|
return lastbucket.ForEach(func(key, _ []byte) error {
|
||||||
writelnBytes(cmd.Stdout, key, *optionsFormat)
|
return writelnBytes(cmd.Stdout, key, *optionsFormat)
|
||||||
return nil
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Usage returns the help message.
|
// Usage returns the help message.
|
||||||
// TODO: Use https://pkg.go.dev/flag#FlagSet.PrintDefaults to print supported
|
// TODO: Use https://pkg.go.dev/flag#FlagSet.PrintDefaults to print supported flags.
|
||||||
//
|
|
||||||
// flags.
|
|
||||||
func (cmd *KeysCommand) Usage() string {
|
func (cmd *KeysCommand) Usage() string {
|
||||||
return strings.TrimLeft(`
|
return strings.TrimLeft(`
|
||||||
usage: bolt keys PATH [BUCKET...]
|
usage: bolt keys PATH [BUCKET...]
|
||||||
@ -1217,7 +1214,8 @@ usage: bolt keys PATH [BUCKET...]
|
|||||||
Print a list of keys in the given (sub)bucket.
|
Print a list of keys in the given (sub)bucket.
|
||||||
=======
|
=======
|
||||||
|
|
||||||
Options:
|
Additional options include:
|
||||||
|
|
||||||
--format
|
--format
|
||||||
Output format. One of: ascii-encoded|hex|bytes (default=bytes)
|
Output format. One of: ascii-encoded|hex|bytes (default=bytes)
|
||||||
|
|
||||||
@ -1247,7 +1245,7 @@ func (cmd *GetCommand) Run(args ...string) error {
|
|||||||
fs := flag.NewFlagSet("", flag.ContinueOnError)
|
fs := flag.NewFlagSet("", flag.ContinueOnError)
|
||||||
var parseFormat string
|
var parseFormat string
|
||||||
var format string
|
var format string
|
||||||
fs.StringVar(&parseFormat, "parse-format", "ascii-encoded", "Output format. One of: ascii-encoded|hex")
|
fs.StringVar(&parseFormat, "parse-format", "ascii-encoded", "Input format. One of: ascii-encoded|hex (default: ascii-encoded)")
|
||||||
fs.StringVar(&format, "format", "bytes", "Output format. One of: ascii-encoded|hex|bytes (default: bytes)")
|
fs.StringVar(&format, "format", "bytes", "Output format. One of: ascii-encoded|hex|bytes (default: bytes)")
|
||||||
help := fs.Bool("h", false, "")
|
help := fs.Bool("h", false, "")
|
||||||
if err := fs.Parse(args); err != nil {
|
if err := fs.Parse(args); err != nil {
|
||||||
@ -1312,6 +1310,13 @@ func (cmd *GetCommand) Usage() string {
|
|||||||
usage: bolt get PATH [BUCKET..] KEY
|
usage: bolt get PATH [BUCKET..] KEY
|
||||||
|
|
||||||
Print the value of the given key in the given (sub)bucket.
|
Print the value of the given key in the given (sub)bucket.
|
||||||
|
|
||||||
|
Additional options include:
|
||||||
|
|
||||||
|
--format
|
||||||
|
Output format. One of: ascii-encoded|hex|bytes (default=bytes)
|
||||||
|
--parse-format
|
||||||
|
Input format (of key). One of: ascii-encoded|hex (default=ascii-encoded)"
|
||||||
`, "\n")
|
`, "\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user