SafeFormat implements SafeFormatter.
(p i.SafePrinter, _ rune)
| 37 | |
| 38 | // SafeFormat implements SafeFormatter. |
| 39 | func (b StringBuilder) SafeFormat(p i.SafePrinter, _ rune) { |
| 40 | // We only support the %v / %s natural print here. |
| 41 | // Go supports other formatting verbs for strings: %x/%X/%q. |
| 42 | // |
| 43 | // We don't do this here, keeping in mind that the output |
| 44 | // of a SafeFormat must remain a redactable string. |
| 45 | // |
| 46 | // %x/%X cannot be implemented because they would turn redaction |
| 47 | // markers into hex codes, and the entire result string would |
| 48 | // appear safe for reporting, which would break the semantics |
| 49 | // of this package. |
| 50 | // |
| 51 | // %q cannot be implemented because it replaces non-ASCII characters |
| 52 | // with numeric unicode escapes, which breaks redaction |
| 53 | // markers too. |
| 54 | p.Print(b.RedactableString()) |
| 55 | } |
| 56 | |
| 57 | var _ i.SafeFormatter = StringBuilder{} |
| 58 | var _ i.SafeFormatter = (*StringBuilder)(nil) |
nothing calls this directly
no test coverage detected