From 01aba571a1b4c11eef3976863c0a7dac5929294a Mon Sep 17 00:00:00 2001 From: Mikhail Dyakov Date: Fri, 23 Oct 2015 21:20:01 +0200 Subject: [PATCH] Handle error in api README example --- api/README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/api/README.md b/api/README.md index bce2ebb516..3b7c89ddbb 100644 --- a/api/README.md +++ b/api/README.md @@ -17,13 +17,18 @@ Usage Below is an example of using the Consul client: ```go -// Get a new client, with KV endpoints -client, _ := api.NewClient(api.DefaultConfig()) +// Get a new client +client, err := api.NewClient(api.DefaultConfig()) +if err != nil { + panic(err) +} + +// Get a handle to the KV API kv := client.KV() // PUT a new KV pair p := &api.KVPair{Key: "foo", Value: []byte("test")} -_, err := kv.Put(p, nil) +_, err = kv.Put(p, nil) if err != nil { panic(err) }