1
0
mirror of https://github.com/chai2010/advanced-go-programming-book.git synced 2025-05-23 20:02:22 +00:00

reply is *string not string

This commit is contained in:
yuanhao 2021-11-23 19:46:05 +08:00 committed by howieyuen
parent 8fef8ea904
commit 72cc470780

View File

@ -32,8 +32,8 @@ func doClientWork(client *rpc.Client) {
} }
args := helloCall.Args.(string) args := helloCall.Args.(string)
reply := helloCall.Reply.(string) reply := helloCall.Reply.(*string)
fmt.Println(args, reply) fmt.Println(args, *reply)
} }
``` ```
@ -246,7 +246,7 @@ func doClientWork(clientChan <-chan *rpc.Client) {
defer client.Close() defer client.Close()
var reply string var reply string
err = client.Call("HelloService.Hello", "hello", &reply) err := client.Call("HelloService.Hello", "hello", &reply)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }