Documentation: fix metadata.FromContext example
metadata.FromContext returns additional boolean value. This fixes the example in metadata documentation.
This commit is contained in:
@ -70,7 +70,8 @@ Metadata can be retrieved from context using `FromContext`:
|
|||||||
|
|
||||||
```go
|
```go
|
||||||
func (s *server) SomeRPC(ctx context.Context, in *pb.SomeRequest) (*pb.SomeResponse, err) {
|
func (s *server) SomeRPC(ctx context.Context, in *pb.SomeRequest) (*pb.SomeResponse, err) {
|
||||||
md := metadata.FromContext(ctx)
|
md, ok := metadata.FromContext(ctx)
|
||||||
|
// do something with metadata
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user