github.com/jfrazelle/docker@v1.1.2-0.20210712172922-bf78e25fe508/testutil/helpers.go (about)

     1  package testutil // import "github.com/docker/docker/testutil"
     2  
     3  import (
     4  	"io"
     5  )
     6  
     7  // DevZero acts like /dev/zero but in an OS-independent fashion.
     8  var DevZero io.Reader = devZero{}
     9  
    10  type devZero struct{}
    11  
    12  func (d devZero) Read(p []byte) (n int, err error) {
    13  	for i := range p {
    14  		p[i] = 0
    15  	}
    16  	return len(p), nil
    17  }