Sort the result of 'Backend.States()'.
This commit is contained in:
parent
70aad79b6e
commit
b896348230
|
@ -3,6 +3,7 @@ package etcd
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
etcdv3 "github.com/coreos/etcd/clientv3"
|
etcdv3 "github.com/coreos/etcd/clientv3"
|
||||||
|
@ -33,6 +34,7 @@ func (b *Backend) States() ([]string, error) {
|
||||||
for _, kv := range res.Kvs {
|
for _, kv := range res.Kvs {
|
||||||
result = append(result, strings.TrimPrefix(string(kv.Key), prefix))
|
result = append(result, strings.TrimPrefix(string(kv.Key), prefix))
|
||||||
}
|
}
|
||||||
|
sort.Strings(result[1:])
|
||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue