From d60a82256d8f42ced31232ff378479e8e5ea7fa7 Mon Sep 17 00:00:00 2001 From: c9s Date: Thu, 3 Dec 2020 09:27:05 +0800 Subject: [PATCH] types: remove slice preallocated cap --- pkg/types/account.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/types/account.go b/pkg/types/account.go index b00c1a67f..e3f45a718 100644 --- a/pkg/types/account.go +++ b/pkg/types/account.go @@ -2,6 +2,7 @@ package types import ( "fmt" + "strings" "sync" "github.com/sirupsen/logrus" @@ -25,6 +26,15 @@ func (b Balance) String() string { type BalanceMap map[string]Balance +func (m BalanceMap) String() string { + var ss []string + for _, b := range m { + ss = append(ss, b.String()) + } + + return "BalanceMap[" + strings.Join(ss, ", ") + "]" +} + func (m BalanceMap) Print() { for _, balance := range m { if balance.Available == 0 && balance.Locked == 0 {