diff options
| author | Paul Buetow <pbuetow@mimecast.com> | 2024-02-23 15:01:41 +0200 |
|---|---|---|
| committer | Paul Buetow <pbuetow@mimecast.com> | 2024-02-23 15:01:41 +0200 |
| commit | a3e10757a52fa47a0608afd88986162ca5eb22cc (patch) | |
| tree | dce61c6695bc3badd455a64767252e6947b32711 /internal/io/fs/readfilelcontext.go | |
| parent | 85780654df870dc4170b93a8ed5a5dbfa917fe5d (diff) | |
lint warnings
Diffstat (limited to 'internal/io/fs/readfilelcontext.go')
| -rw-r--r-- | internal/io/fs/readfilelcontext.go | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/internal/io/fs/readfilelcontext.go b/internal/io/fs/readfilelcontext.go index 44ce17d..87d59d6 100644 --- a/internal/io/fs/readfilelcontext.go +++ b/internal/io/fs/readfilelcontext.go @@ -31,22 +31,17 @@ type ltxState struct { func (f *readFile) filterWithoutLContext(ctx context.Context, rawLines <-chan *bytes.Buffer, lines chan<- *line.Line, re regex.Regex) { - for { - select { - case rawLine, ok := <-rawLines: - f.updatePosition() - if !ok { + for rawLine := range rawLines { + f.updatePosition() + if newLine, ok := f.transmittable(rawLine, len(lines), cap(lines), re); ok { + select { + case lines <- newLine: + case <-ctx.Done(): return } - if newLine, ok := f.transmittable(rawLine, len(lines), cap(lines), re); ok { - select { - case lines <- newLine: - case <-ctx.Done(): - return - } - } } } + f.updatePosition() } // Filter log lines matching a given regular expression, however with local grep context. |
