format

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2026 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package format implements the Go-template-to-formatted-Go pipeline.

Format(text) parses the text as a Go template, replaces each {{…}} action with a sentinel, runs gofumpt on the resulting Go, then substitutes the original action bytes back. When gofumpt rejects the stubbed Go, Format falls back to the parser's own AST printer so the output is at least idempotent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(text string) (string, error)

Format formats a Go template source string. The interface is deliberately minimal: no options, no modes.

Returns an error only for genuine parse failures of the template itself. gofumpt rejection of the stubbed Go is handled internally by falling back to the AST printer; the caller never sees that.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL