From e34d969e472285fe547462507456e86b4ebd3f6a Mon Sep 17 00:00:00 2001 From: mikespook Date: Sun, 9 Oct 2011 17:53:55 +0800 Subject: [PATCH] Fix bugs in example codes. --- example/client.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/example/client.go b/example/client.go index 5af807b..2562be2 100644 --- a/example/client.go +++ b/example/client.go @@ -8,29 +8,31 @@ import ( func main() { client := gearman.NewClient() defer client.Close() - client.AddServer("127.0.0.1:4730") + if err := client.AddServer("127.0.0.1:4730"); err != nil { + log.Fatalln(err) + } echo := []byte("Hello\x00 world") if data, err := client.Echo(echo); err != nil { - log.Println(string(data)) + log.Fatalln(string(data)) } handle, err := client.Do("ToUpper", echo, gearman.JOB_NORMAL) if err != nil { - log.Println(err) + log.Fatalln(err) } else { log.Println(handle) - job := <-client.JobQueue + /*job := <-client.JobQueue if data, err := job.Result(); err != nil { - log.Println(err) + log.Fatalln(err) } else { log.Println(string(data)) - } + }*/ } known, running, numerator, denominator, err := client.Status(handle) if err != nil { - log.Println(err) + log.Fatalln(err) } if !known { log.Println("Unknown")