Flush will return all queued writes, and return "" (empty string) in nothing has been queued "buf.WriteByte('" + byte + "')" + '\n' if one bute has been queued. "buf.WriteString(`" + string + "`)" + "\n" if more than one byte has been queued.
()
| 33 | // "buf.WriteByte('" + byte + "')" + '\n' if one bute has been queued. |
| 34 | // "buf.WriteString(`" + string + "`)" + "\n" if more than one byte has been queued. |
| 35 | func (w *ConditionalWrite) Flush() string { |
| 36 | combined := strings.Join(w.Queued, "") |
| 37 | if len(combined) == 0 { |
| 38 | return "" |
| 39 | } |
| 40 | |
| 41 | w.Queued = nil |
| 42 | if len(combined) == 1 { |
| 43 | return "buf.WriteByte('" + combined + "')" + "\n" |
| 44 | } |
| 45 | return "buf.WriteString(`" + combined + "`)" + "\n" |
| 46 | } |
| 47 | |
| 48 | func (w *ConditionalWrite) FlushTo(out string) string { |
| 49 | out += w.Flush() |
no outgoing calls
no test coverage detected