github.com/searKing/golang/go@v1.2.117/io/eof.go (about)

     1  // Copyright 2020 The searKing Author. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package io
     6  
     7  import "io"
     8  
     9  type eofReader struct{}
    10  
    11  func (eofReader) Read([]byte) (int, error) {
    12  	return 0, io.EOF
    13  }
    14  
    15  // EOFReader returns a Reader that return EOF anytime.
    16  func EOFReader() io.Reader {
    17  	return eofReader{}
    18  }