client: sort nodes in example

release-3.3
Anthony Romano 2017-06-06 10:56:03 -07:00
parent 402fa8a827
commit 1711fdba32
1 changed files with 2 additions and 0 deletions

View File

@ -17,6 +17,7 @@ package client_test
import (
"fmt"
"log"
"sort"
"github.com/coreos/etcd/client"
"golang.org/x/net/context"
@ -55,6 +56,7 @@ func ExampleKeysAPI_directory() {
log.Fatal(err)
}
// print directory keys
sort.Sort(resp.Node.Nodes)
for _, n := range resp.Node.Nodes {
fmt.Printf("Key: %q, Value: %q\n", n.Key, n.Value)
}