Sort the result of 'Backend.States()'.

This commit is contained in:
Bruno Miguel Custodio 2017-09-08 12:25:15 +01:00
parent 70aad79b6e
commit b896348230
No known key found for this signature in database
GPG Key ID: 84CDD9E18A1A6B2C
1 changed files with 2 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package etcd
import (
"context"
"fmt"
"sort"
"strings"
etcdv3 "github.com/coreos/etcd/clientv3"
@ -33,6 +34,7 @@ func (b *Backend) States() ([]string, error) {
for _, kv := range res.Kvs {
result = append(result, strings.TrimPrefix(string(kv.Key), prefix))
}
sort.Strings(result[1:])
return result, nil
}