Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utils/bag: print generic type for bag elements #1507

Merged
merged 9 commits into from
May 18, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
utils/bag: print generic type for bag elements
Signed-off-by: Gyuho Lee <gyuho.lee@avalabs.org>
  • Loading branch information
gyuho committed May 15, 2023
commit 0a4d8f4a1412e0af3659c28cc516a3b7ca05f19e
4 changes: 2 additions & 2 deletions utils/bag/bag.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ func (b *Bag[T]) Remove(elt T) {
b.size -= count
}

func (b *Bag[_]) PrefixedString(prefix string) string {
func (b *Bag[T]) PrefixedString(prefix string) string {
sb := strings.Builder{}

sb.WriteString(fmt.Sprintf("Bag: (Size = %d)", b.Len()))
sb.WriteString(fmt.Sprintf("Bag[%T]: (Size = %d)", *new(T), b.Len()))
for elt, count := range b.counts {
sb.WriteString(fmt.Sprintf("\n%s %v: %d", prefix, elt, count))
}
Expand Down