bitbucket.org/ai69/amoy@v0.2.3/discard.go (about)

     1  package amoy
     2  
     3  import "io"
     4  
     5  // DiscardWriter is a Writer on which all Write calls succeed without doing anything.
     6  var DiscardWriter = io.Discard
     7  
     8  // DiscardWriteCloser is a WriteCloser on which all Write calls succeed without doing anything.
     9  var DiscardWriteCloser io.WriteCloser = discardCloser{}
    10  
    11  type discardCloser struct{}
    12  
    13  func (discardCloser) Write(p []byte) (int, error) {
    14  	return len(p), nil
    15  }
    16  
    17  func (discardCloser) WriteString(s string) (int, error) {
    18  	return len(s), nil
    19  }
    20  
    21  func (discardCloser) Close() error {
    22  	return nil
    23  }