finalize ensures that all the buffer is properly marked.
()
| 182 | // finalize ensures that all the buffer is properly |
| 183 | // marked. |
| 184 | func (b *Buffer) finalize() { |
| 185 | if b.mode == SafeRaw { |
| 186 | b.validUntil = len(b.buf) |
| 187 | } else { |
| 188 | b.escapeToEnd(b.mode == UnsafeEscaped /* breakNewLines */) |
| 189 | } |
| 190 | if b.markerOpen { |
| 191 | b.endRedactable() |
| 192 | b.validUntil = len(b.buf) |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | // endRedactable adds the closing redaction marker. |
| 197 | func (b *Buffer) endRedactable() { |