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

Merge pull request #558 from howieyuen/ch04-3

reply is *string not string
This commit is contained in:
chai2010 2021-11-25 08:40:04 +08:00 committed by GitHub
commit aa6cb03719
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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