From 6031ce78df6cda9c8b924b231554bb4e0c077358 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 6 Dec 2021 09:39:33 +0000 Subject: Refactor local context filter method to reduce its cognitive complexity --- internal/io/fs/readfile.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'internal/io/fs/readfile.go') diff --git a/internal/io/fs/readfile.go b/internal/io/fs/readfile.go index f37b07d..90c5966 100644 --- a/internal/io/fs/readfile.go +++ b/internal/io/fs/readfile.go @@ -26,6 +26,7 @@ import ( type readStatus int const ( + nothing readStatus = iota abortReading readStatus = iota continueReading readStatus = iota ) @@ -300,7 +301,7 @@ func (f *readFile) handleReadError(ctx context.Context, err error, fd *os.File, return abortReading, nil } - return continueReading, nil + return nothing, nil } // Now process the byte we just read from the fd. @@ -333,5 +334,5 @@ func (f *readFile) handleReadByte(ctx context.Context, b byte, } } - return continueReading, message + return nothing, message } -- cgit v1.2.3