diff --git a/backend/ids.go b/backend/ids.go index f2569f7e0..11cf436d2 100644 --- a/backend/ids.go +++ b/backend/ids.go @@ -1,5 +1,10 @@ package backend +import ( + "encoding/hex" + "fmt" +) + // IDs is an ordered list of IDs that implements sort.Interface. type IDs []ID @@ -48,3 +53,17 @@ func (ids IDs) Uniq() (list IDs) { return list } + +type shortID ID + +func (id shortID) String() string { + return hex.EncodeToString(id[:shortStr]) +} + +func (ids IDs) String() string { + elements := make([]shortID, 0, len(ids)) + for _, id := range ids { + elements = append(elements, shortID(id)) + } + return fmt.Sprintf("%v", elements) +}