Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

chore: add String() method to IDSlice type #238

Merged
merged 1 commit into from
Mar 21, 2022
Merged
Changes from all commits
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
8 changes: 8 additions & 0 deletions peer/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,11 @@ type IDSlice []ID
func (es IDSlice) Len() int { return len(es) }
func (es IDSlice) Swap(i, j int) { es[i], es[j] = es[j], es[i] }
func (es IDSlice) Less(i, j int) bool { return string(es[i]) < string(es[j]) }

func (es IDSlice) String() string {
peersStrings := make([]string, len(es))
for i, id := range es {
peersStrings[i] = id.String()
}
return strings.Join(peersStrings, ", ")
}