MCPcopy Create free account
hub / github.com/cockroachdb/redact / endRedactable

Method endRedactable

internal/buffer/buffer.go:197–212  ·  view source on GitHub ↗

endRedactable adds the closing redaction marker.

()

Source from the content-addressed store, hash-verified

195
196// endRedactable adds the closing redaction marker.
197func (b *Buffer) endRedactable() {
198 if len(b.buf) == 0 {
199 return
200 }
201 if bytes.HasSuffix(b.buf, m.StartBytes) {
202 // Special case: remove a trailing open marker and call it a day.
203 b.buf = b.buf[:len(b.buf)-m.StartLen]
204 } else {
205 p, ok := b.tryGrowByReslice(m.EndLen)
206 if !ok {
207 p = b.grow(m.EndLen)
208 }
209 copy(b.buf[p:], m.EndS)
210 }
211 b.markerOpen = false
212}
213
214func (b *Buffer) startWrite() {
215 if b.mode == UnsafeEscaped && !b.markerOpen {

Callers 2

finalizeMethod · 0.95
SetModeMethod · 0.95

Calls 2

tryGrowByResliceMethod · 0.95
growMethod · 0.95

Tested by

no test coverage detected