format

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package format formats Kukel source (kukel fmt): it re-indents lines and normalizes the spaces between tokens. Line breaks and comments stay where they are, and at most one blank line in a row is kept. A statement that starts with if, while, do, for, switch, try or with gets a blank line before it (breathing space), unless it starts a block or follows a label (see breathe).

The result is checked: read again, it must give the same tokens and comments as the input, or Source refuses it (so formatting can never change a program).

Index

Constants

View Source
const Indent = "    "

Indent is one level of indentation.

Variables

This section is empty.

Functions

func Source

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

Source formats one source file. A file that does not parse is not formatted: the syntax error is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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