Sort childrens in ls: /v1/ls/path/to/node
This commit is contained in:
parent
38c820280e
commit
0cc4c91e01
@ -3,6 +3,7 @@ package rest
|
||||
import (
|
||||
"github.com/samuel/go-zookeeper/zk"
|
||||
"log"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@ -26,7 +27,7 @@ type Zk struct {
|
||||
func (conf Zk) InitConnection() (*zk.Conn, error) {
|
||||
conn, _, err := zk.Connect(conf.Hosts, time.Second)
|
||||
if err != nil {
|
||||
log.Panic("[ERROR] ", err)
|
||||
log.Fatal("[ERROR] ", err)
|
||||
}
|
||||
|
||||
return conn, err
|
||||
@ -77,6 +78,9 @@ func (z ZooNode) GetChildrens(path string) Ls {
|
||||
// }
|
||||
// }
|
||||
|
||||
// Sort childrens alphabeticaly
|
||||
sort.Strings(childrens)
|
||||
|
||||
l.Error = ""
|
||||
l.Childrens = childrens
|
||||
l.ZkStat = zkStat
|
||||
|
Loading…
Reference in New Issue
Block a user