drainToEOF reads from the stream until io.EOF or another non-nil error. Per the gRPC contract, the trailer is only reachable after Recv returns a non-nil error — io.EOF is the expected terminator for a clean DoPut/ExecuteUpdate exchange.
(stream pb.FlightService_DoPutClient)
| 83 | // a non-nil error — io.EOF is the expected terminator for a clean |
| 84 | // DoPut/ExecuteUpdate exchange. |
| 85 | func drainToEOF(stream pb.FlightService_DoPutClient) error { |
| 86 | for { |
| 87 | _, err := stream.Recv() |
| 88 | if err == nil { |
| 89 | continue |
| 90 | } |
| 91 | if errors.Is(err, io.EOF) { |
| 92 | return nil |
| 93 | } |
| 94 | return err |
| 95 | } |
| 96 | } |
no test coverage detected