Skip to content

Commit

Permalink
Empty reader returns EOF
Browse files Browse the repository at this point in the history
  • Loading branch information
tdewolff committed Jan 15, 2017
1 parent 8bd25d2 commit a7cf99a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions readers.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,11 @@ func (r *ErrorReader) Read(b []byte) (n int, err error) {
////////////////////////////////////////////////////////////////

// InfiniteReader implements an io.Reader that will always read-in one character.
type InfiniteReader struct {
n int
}
type InfiniteReader struct{}

// NewInfiniteReader returns a new InfiniteReader.
func NewInfiniteReader(n int) *InfiniteReader {
return &InfiniteReader{n}
func NewInfiniteReader() *InfiniteReader {
return &InfiniteReader{}
}

// Read implements the io.Reader interface.
Expand All @@ -76,5 +74,5 @@ func NewEmptyReader() *EmptyReader {

// Read implements the io.Reader interface.
func (r *EmptyReader) Read(b []byte) (n int, err error) {
return 0, nil
return 0, io.EOF
}

0 comments on commit a7cf99a

Please sign in to comment.