mirror of https://github.com/grpc/grpc.io.git
Use exported Get methods in Go quick-start
Suggest users to use the exported Get methods instead of directly accessing the data.
This commit is contained in:
parent
ab18a3d847
commit
f028dbcfeb
|
|
@ -162,7 +162,7 @@ Edit `greeter_server/main.go` and add the following function to it:
|
|||
|
||||
```go
|
||||
func (s *server) SayHelloAgain(ctx context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) {
|
||||
return &pb.HelloReply{Message: "Hello again " + in.Name}, nil
|
||||
return &pb.HelloReply{Message: "Hello again " + in.GetName()}, nil
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -175,7 +175,7 @@ r, err = c.SayHelloAgain(ctx, &pb.HelloRequest{Name: name})
|
|||
if err != nil {
|
||||
log.Fatalf("could not greet: %v", err)
|
||||
}
|
||||
log.Printf("Greeting: %s", r.Message)
|
||||
log.Printf("Greeting: %s", r.GetMessage())
|
||||
```
|
||||
|
||||
#### Run!
|
||||
|
|
@ -206,4 +206,4 @@ Greeting: Hello again world
|
|||
and [gRPC Concepts](/docs/guides/concepts/)
|
||||
- Work through a more detailed tutorial in [gRPC Basics: Go](/docs/tutorials/basic/go/)
|
||||
- Explore the gRPC Go core API in its [reference
|
||||
documentation](https://godoc.org/google.golang.org/grpc)
|
||||
documentation](https://godoc.org/google.golang.org/grpc)
|
||||
|
|
|
|||
Loading…
Reference in New Issue