format

package
v0.0.200 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package format normalizes bork source whitespace without changing its layout.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Files

func Files(paths []string, check bool) ([]string, error)

Files formats .bork files and recursively visits directories. An empty path list means the current directory. In check mode no files are written. The returned paths identify files that differ from the canonical format.

func FilesWithOptions added in v0.0.190

func FilesWithOptions(paths []string, check bool, options Options) ([]string, error)

FilesWithOptions formats files with explicit cleanup options.

func Source

func Source(path string, src []byte) ([]byte, error)

Source formats one file. Existing line breaks are retained, blank-line runs become one blank line, and nested delimiters use two spaces. Comments, literals, interpolations and unsafe Go bodies retain their exact text, except CRLF line comment endings become LF. Lexically invalid input is rejected; incomplete or ill-typed programs, including reserved compiler identifiers, can still be formatted.

func SourceWithOptions added in v0.0.190

func SourceWithOptions(path string, src []byte, options Options) ([]byte, error)

SourceWithOptions formats source and optionally removes redundant head parentheses.

Types

type Options added in v0.0.190

type Options struct{ Simplify bool }

Options selects explicit source cleanups in addition to whitespace formatting.

Jump to

Keyboard shortcuts

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