From 0bbc7762e15d913622b877833838440f81cff00b Mon Sep 17 00:00:00 2001 From: losfair Date: Tue, 10 Oct 2023 00:53:33 +0800 Subject: [PATCH] fix: send error to channel in readAndWrite --- main.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.go b/main.go index dbece6b..fd20716 100644 --- a/main.go +++ b/main.go @@ -48,11 +48,13 @@ func readAndWrite(ctx context.Context, r io.Reader, w io.Writer, wg *sync.WaitGr default: nr, err := r.Read(buff) if err != nil { + c <- err return } if nr > 0 { _, err := w.Write(buff[:nr]) if err != nil { + c <- err return } }