Skip to content

Commit

Permalink
feat(scanner): fix Scan function
Browse files Browse the repository at this point in the history
  • Loading branch information
KevRiver authored and aybabtme committed Nov 6, 2024
1 parent 1a3ae08 commit ec884b0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func Scan(ctx context.Context, src io.Reader, sink sink.Sink, opts *HandlerOptio
data := new(typesv1.StructuredLogEvent)
ev.Structured = data

skipNextScan := false
for {
if !in.Scan() {
err := in.Err()
Expand All @@ -42,11 +43,15 @@ func Scan(ctx context.Context, src io.Reader, sink sink.Sink, opts *HandlerOptio
in = bufio.NewScanner(src)
in.Buffer(make([]byte, 0, maxBufferSize), maxBufferSize)
in.Split(bufio.ScanLines)
in.Scan()
skipNextScan = true
continue
}
break
}
if skipNextScan {
skipNextScan = false
continue
}

line++
lineData := in.Bytes()
Expand Down

0 comments on commit ec884b0

Please sign in to comment.