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

Commit 4a03a82

Browse files
chore: add String() method to IDSlice type (#238)
1 parent 243f8b9 commit 4a03a82

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

peer/peer.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,11 @@ type IDSlice []ID
209209
func (es IDSlice) Len() int { return len(es) }
210210
func (es IDSlice) Swap(i, j int) { es[i], es[j] = es[j], es[i] }
211211
func (es IDSlice) Less(i, j int) bool { return string(es[i]) < string(es[j]) }
212+
213+
func (es IDSlice) String() string {
214+
peersStrings := make([]string, len(es))
215+
for i, id := range es {
216+
peersStrings[i] = id.String()
217+
}
218+
return strings.Join(peersStrings, ", ")
219+
}

0 commit comments

Comments
 (0)