Check for nil rather than length

This commit is contained in:
Joel Watson 2020-11-10 16:39:12 -06:00
parent a88177fbf9
commit 99698737d9
2 changed files with 2 additions and 2 deletions

View File

@ -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", "----", "----", "----")

View File

@ -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 {