From be8bfa012ef2745ab8867fa2fa6a896a8c432227 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Wed, 25 Apr 2018 15:55:32 +0200 Subject: [PATCH] [internal.http.reader] auto-correcting (no error raised) --- internal/http/reader/reader.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/http/reader/reader.go b/internal/http/reader/reader.go index 25fd5b3..19f9b95 100644 --- a/internal/http/reader/reader.go +++ b/internal/http/reader/reader.go @@ -6,7 +6,6 @@ package reader // the golang standard library import ( - "fmt" "io" "bufio" ) @@ -22,14 +21,14 @@ type chunkReader struct { // New creates a new reader -func NewReader(r io.Reader) (reader *chunkReader, err error) { +func NewReader(r io.Reader) (reader *chunkReader) { br, ok := r.(*bufio.Reader) if !ok { - return nil, fmt.Errorf("Invalid reader (must implement bufio.Reader") + br = bufio.NewReader(r) } - return &chunkReader{reader: br}, nil + return &chunkReader{reader: br} }