(rw *bufio.ReadWriter, resp *protocol.IpcResponse)
| 20 | var pjUnmarshal = protojson.UnmarshalOptions{DiscardUnknown: true} |
| 21 | |
| 22 | func writeResponse(rw *bufio.ReadWriter, resp *protocol.IpcResponse) error { |
| 23 | data, err := pjMarshal.Marshal(resp) |
| 24 | if err != nil { |
| 25 | return fmt.Errorf("marshal response: %w", err) |
| 26 | } |
| 27 | _, err = rw.Write(data) |
| 28 | if err != nil { |
| 29 | return err |
| 30 | } |
| 31 | _, err = rw.WriteString("\n") |
| 32 | if err != nil { |
| 33 | return err |
| 34 | } |
| 35 | return rw.Flush() |
| 36 | } |
| 37 | |
| 38 | func errResponse(msg string) *protocol.IpcResponse { |
| 39 | return &protocol.IpcResponse{Ok: false, Error: msg} |
no test coverage detected