You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

16 lines
285 B

package testutil
import "io"
// ErrWriter returns an io.Writer that returns 0, err from all Write calls.
func ErrWriter(err error) io.Writer {
return &errWriter{err: err}
}
type errWriter struct {
err error
}
func (r *errWriter) Write(p []byte) (int, error) {
return 0, r.err
}