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 ( import (
"fmt" "fmt"
"strings"
"sync" "sync"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
@ -25,6 +26,15 @@ func (b Balance) String() string {
type BalanceMap map[string]Balance 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() { func (m BalanceMap) Print() {
for _, balance := range m { for _, balance := range m {
if balance.Available == 0 && balance.Locked == 0 { if balance.Available == 0 && balance.Locked == 0 {