(line []byte)
| 391 | } |
| 392 | |
| 393 | func tryParseJSONLine(line []byte) *jsonTestEvent { |
| 394 | if len(line) == 0 || line[0] != 123 { |
| 395 | return nil |
| 396 | } |
| 397 | |
| 398 | // Try to decode JSON line |
| 399 | decoder := json.NewDecoder(bytes.NewReader(line)) |
| 400 | jsonLine := &jsonTestEvent{} |
| 401 | if err := decoder.Decode(jsonLine); err != nil { |
| 402 | return nil |
| 403 | } |
| 404 | return jsonLine |
| 405 | } |
| 406 | |
| 407 | func parseLine(currentState state, line []byte, output chan<- Event) state { |
| 408 | jsonLine := tryParseJSONLine(line) |