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

Commit

Permalink
chore: add String() method to IDSlice type (#238)
Browse files Browse the repository at this point in the history
  • Loading branch information
EclesioMeloJunior authored Mar 21, 2022
1 parent 243f8b9 commit 4a03a82
Showing 1 changed file with 8 additions and 0 deletions.
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, ", ")
}

0 comments on commit 4a03a82

Please sign in to comment.