WithFlags changes the flags in the FmtCtx, runs the given function, then restores the old flags.
(flags FmtFlags, fn func())
| 446 | // WithFlags changes the flags in the FmtCtx, runs the given function, then |
| 447 | // restores the old flags. |
| 448 | func (ctx *FmtCtx) WithFlags(flags FmtFlags, fn func()) { |
| 449 | if ctx.ann == nil && flags&flagsRequiringAnnotations != 0 { |
| 450 | panic(errors.AssertionFailedf("no Annotations provided")) |
| 451 | } |
| 452 | oldFlags := ctx.flags |
| 453 | ctx.flags = flags |
| 454 | defer func() { ctx.flags = oldFlags }() |
| 455 | |
| 456 | fn() |
| 457 | } |
| 458 | |
| 459 | // WithoutConstantRedaction modifies FmtCtx to ensure that constants are |
| 460 | // displayed rather than being replaced by '_', calls fn, then restores the |
no outgoing calls
no test coverage detected