Sort the result of 'Backend.States()'.
This commit is contained in:
parent
70aad79b6e
commit
b896348230
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue