mirror of https://github.com/status-im/consul.git
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.
This commit is contained in:
parent
5b4c8571d2
commit
0d48559416
|
@ -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…
Reference in New Issue