From a4e8681a0dd9e73d698ab7e8de0a196db6af0c25 Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Wed, 2 Jul 2014 17:55:00 +0300 Subject: [PATCH] Fix examples. --- example_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/example_test.go b/example_test.go index b75163c..f4f93fb 100644 --- a/example_test.go +++ b/example_test.go @@ -13,6 +13,7 @@ func init() { client = redis.NewTCPClient(&redis.Options{ Addr: ":6379", }) + client.FlushDb() } func ExampleNewTCPClient() { @@ -40,9 +41,10 @@ func ExampleClient() { } func ExampleClient_Pipelined() { - cmds, err := client.Pipelined(func(c *redis.Pipeline) { + cmds, err := client.Pipelined(func(c *redis.Pipeline) error { c.Set("key1", "hello1") c.Get("key1") + return nil }) fmt.Println(err) set := cmds[0].(*redis.StatusCmd) @@ -75,8 +77,9 @@ func ExampleMulti() { } n, _ := strconv.ParseInt(s, 10, 64) - return tx.Exec(func() { + return tx.Exec(func() error { tx.Set("key", strconv.FormatInt(n+1, 10)) + return nil }) }