New returns a new Writer that writes to w.
(w io.Writer)
| 20 | |
| 21 | // New returns a new Writer that writes to w. |
| 22 | func New(w io.Writer) *Writer { |
| 23 | return &Writer{ |
| 24 | w: w, |
| 25 | |
| 26 | errorf: func(f string, v ...interface{}) { |
| 27 | // Avoid the builtin println, which writes to fd 2 |
| 28 | // unsynchronized and can corrupt concurrent go test output. |
| 29 | fmt.Fprintf(os.Stderr, f+"\n", v...) |
| 30 | }, |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | func (w *Writer) Write(name string, p []byte) { |
| 35 | w.mu.Lock() |
no outgoing calls