String returns the content with ANSI escape sequences neutralized. It is called automatically by the fmt package, so printing an Untrusted value is safe by default on every fmt path.
()
| 36 | // called automatically by the fmt package, so printing an Untrusted value is |
| 37 | // safe by default on every fmt path. |
| 38 | func (u Untrusted) String() string { |
| 39 | sanitized, _, err := transform.String(&asciisanitizer.Sanitizer{}, u.raw) |
| 40 | if err != nil { |
| 41 | return stripControl(u.raw) |
| 42 | } |
| 43 | return sanitized |
| 44 | } |
| 45 | |
| 46 | // Raw returns the unsanitized content. It is the explicit, greppable opt-out |
| 47 | // for non-terminal uses (hashing, writing to disk, piping). Never pass the |