types: remove slice preallocated cap

This commit is contained in:
c9s 2020-12-03 09:27:05 +08:00
parent 2b264905f9
commit d60a82256d

View File

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