Drain returns the buffered content and resets the buffer atomically.
()
| 52 | |
| 53 | // Drain returns the buffered content and resets the buffer atomically. |
| 54 | func (b *Buffer) Drain() string { |
| 55 | b.mu.Lock() |
| 56 | defer b.mu.Unlock() |
| 57 | s := b.buf.String() |
| 58 | b.buf.Reset() |
| 59 | return s |
| 60 | } |