github.com/haraldrudell/parl@v0.4.176/pio/eof-reader.go (about)

     1  /*
     2  © 2021–present Harald Rudell <harald.rudell@gmail.com> (https://haraldrudell.github.io/haraldrudell/)
     3  ISC License
     4  */
     5  
     6  // EofReader is an empty reader returning EOF. Thread-safe
     7  package pio
     8  
     9  import "io"
    10  
    11  type eofReader struct{}
    12  
    13  // EofReader is an empty reader returning EOF. Thread-safe
    14  var EofReader io.Reader = &eofReader{}
    15  
    16  // Read always return io.EOF menaing end-of-file
    17  func (eof *eofReader) Read(p []byte) (n int, err error) {
    18  	err = io.EOF
    19  	return
    20  }