WriteMessage marshals a proto message and writes it as a framed message with the given tag.
(w io.Writer, tag Tag, msg proto.Message)
| 178 | // WriteMessage marshals a proto message and writes it as a framed message |
| 179 | // with the given tag. |
| 180 | func WriteMessage(w io.Writer, tag Tag, msg proto.Message) error { |
| 181 | data, err := proto.Marshal(msg) |
| 182 | if err != nil { |
| 183 | return xerrors.Errorf("marshal: %w", err) |
| 184 | } |
| 185 | return WriteFrame(w, tag, data) |
| 186 | } |