diff --git a/rest/zoo.go b/rest/zoo.go index 32cadcb..f89491b 100644 --- a/rest/zoo.go +++ b/rest/zoo.go @@ -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