From b2b51abfdc2eaefe6cf4aaf8645bbc7c52d89ff9 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 18 Feb 2023 14:54:36 -0700 Subject: fastio: NewAllWriter: Add a special case for io.Discard --- internal/fastio/allwriter.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'internal/fastio/allwriter.go') diff --git a/internal/fastio/allwriter.go b/internal/fastio/allwriter.go index c587531..071d709 100644 --- a/internal/fastio/allwriter.go +++ b/internal/fastio/allwriter.go @@ -139,6 +139,9 @@ func (w writerYYNWrapper) WriteString(s string) (int, error) { return WriteStrin // the io.Writer already has any of the other write methods, then its // native version of those methods are used. func NewAllWriter(inner io.Writer) AllWriter { + if inner == io.Discard { + return Discard + } switch inner := inner.(type) { // 3 Y bits case AllWriter: // YYY: -- cgit v1.2.3-2-g168b