Browse Source

Length check is required here

If one isn't included, then the nil check in the formatter never fails due to an empty slice being passed in, which causes the kv output to always get printed.
pull/9098/head
Joel Watson 4 years ago
parent
commit
0d48559416
  1. 5
      command/snapshot/inspect/snapshot_inspect.go

5
command/snapshot/inspect/snapshot_inspect.go

@ -189,8 +189,9 @@ func generateStats(info SnapshotInfo) []typeStats {
// Generate the KV stats for the output struct that's
// used to produce the printed output the user sees.
func generateKVStats(info SnapshotInfo) []typeStats {
if info.StatsKV != nil {
ks := make([]typeStats, 0, len(info.StatsKV))
kvLen := len(info.StatsKV)
if kvLen > 0 {
ks := make([]typeStats, 0, kvLen)
for _, s := range info.StatsKV {
ks = append(ks, s)

Loading…
Cancel
Save