Explorar o código

Merge pull request #8039 from heyitsanthony/client-example-sort

client: sort nodes in example
Anthony Romano %!s(int64=9) %!d(string=hai) anos
pai
achega
7350525937
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  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)
 	}