Browse Source

client: sort nodes in example

Anthony Romano 8 years ago
parent
commit
1711fdba32
1 changed files with 2 additions and 0 deletions
  1. 2 0
      client/example_keys_test.go

+ 2 - 0
client/example_keys_test.go

@@ -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)
 	}