WithAnnotations modifies FmtCtx to use the provided Annotations, calls fn, then restores the original ones.
(ann *Annotations, fn func())
| 471 | // WithAnnotations modifies FmtCtx to use the provided Annotations, calls fn, |
| 472 | // then restores the original ones. |
| 473 | func (ctx *FmtCtx) WithAnnotations(ann *Annotations, fn func()) { |
| 474 | defer func(oldAnn *Annotations) { |
| 475 | ctx.ann = oldAnn |
| 476 | }(ctx.ann) |
| 477 | ctx.ann = ann |
| 478 | |
| 479 | fn() |
| 480 | } |
| 481 | |
| 482 | // HasFlags returns true iff all of the given flags are set in the formatter |
| 483 | // context. |