Help us shape the future of Go! Take the 2026 Go Developer Survey

formatter

package
v0.58.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package formatter provides conservative, deterministic formatting for NFlow source. It preserves expression text, comments, strings, and opaque directive bodies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Formatter

type Formatter struct {
	// contains filtered or unexported fields
}

Formatter formats source using the parser extensions supplied by the caller.

func New

func New(bundles []compiler.Bundle) *Formatter

New builds a formatter from the active Flow bundles. The same bundles should be supplied by the host that exposes the formatter, so extension syntax is parsed consistently with that host.

func NewWithParserTables added in v0.44.0

func NewWithParserTables(
	operators *compiler.OperatorTable,
	primaries *compiler.PrimaryExtensionTable,
	requireEnabled bool,
	directives ...compiler.Directive,
) *Formatter

NewWithParserTables builds a formatter from the active compiler tables. Hosts that prepare a source with dynamically selected bundles should use these tables so formatting and compilation recognize the same syntax.

func (*Formatter) Format

func (f *Formatter) Format(ctx context.Context, source, file string) (string, error)

Format returns canonical source or a source-positioned parse error. It does not preprocess the file, load includes, resolve actions, or execute code.

Jump to

Keyboard shortcuts

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