diff --git a/command/snapshot/inspect/formatter.go b/command/snapshot/inspect/formatter.go index bd45501ab..c8c308b5f 100644 --- a/command/snapshot/inspect/formatter.go +++ b/command/snapshot/inspect/formatter.go @@ -57,7 +57,7 @@ func (_ *prettyFormatter) Format(info *OutputFormat) (string, error) { fmt.Fprintf(tw, "\n %s\t%s\t%s\t", "----", "----", "----") fmt.Fprintf(tw, "\n Total\t\t%s\t", ByteSize(uint64(info.TotalSize))) - if len(info.StatsKV) > 0 { + if info.StatsKV != nil { fmt.Fprintf(tw, "\n") fmt.Fprintln(tw, "\n Key Name\tCount\tSize\t") fmt.Fprintf(tw, " %s\t%s\t%s\t", "----", "----", "----") diff --git a/command/snapshot/inspect/snapshot_inspect.go b/command/snapshot/inspect/snapshot_inspect.go index 5c40c1c67..83216cc4d 100644 --- a/command/snapshot/inspect/snapshot_inspect.go +++ b/command/snapshot/inspect/snapshot_inspect.go @@ -199,7 +199,7 @@ func generateStats(info SnapshotInfo) []typeStats { } func generateKVStats(info SnapshotInfo) []typeStats { - if len(info.StatsKV) > 0 { + if info.StatsKV != nil { ks := make([]typeStats, 0, len(info.StatsKV)) for _, s := range info.StatsKV {