MCPcopy Create free account
hub / github.com/GoTestTools/gotestfmt / tryParseJSONLine

Function tryParseJSONLine

tokenizer/tokenizer.go:393–405  ·  view source on GitHub ↗
(line []byte)

Source from the content-addressed store, hash-verified

391}
392
393func 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
407func parseLine(currentState state, line []byte, output chan<- Event) state {
408 jsonLine := tryParseJSONLine(line)

Callers 1

parseLineFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected