Merge pull request #47 from le-michael/patch-1

Use proto message Get methods in Go quick start
This commit is contained in:
Srini Polavarapu 2019-09-04 15:02:41 -07:00 committed by GitHub
commit f61a2370ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -162,7 +162,7 @@ Edit `greeter_server/main.go` and add the following function to it:
```go ```go
func (s *server) SayHelloAgain(ctx context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) { 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 { if err != nil {
log.Fatalf("could not greet: %v", err) log.Fatalf("could not greet: %v", err)
} }
log.Printf("Greeting: %s", r.Message) log.Printf("Greeting: %s", r.GetMessage())
``` ```
#### Run! #### Run!
@ -206,4 +206,4 @@ Greeting: Hello again world
and [gRPC Concepts](/docs/guides/concepts/) and [gRPC Concepts](/docs/guides/concepts/)
- Work through a more detailed tutorial in [gRPC Basics: Go](/docs/tutorials/basic/go/) - Work through a more detailed tutorial in [gRPC Basics: Go](/docs/tutorials/basic/go/)
- Explore the gRPC Go core API in its [reference - 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)